Skip to content

Commit

Permalink
[pkl.experimental.net] Fix uri encoding (#54)
Browse files Browse the repository at this point in the history
Co-authored-by: Rob Napier <rob@neverwood.org>
  • Loading branch information
bioball and rnapier authored Apr 24, 2024
1 parent fffa03d commit 2387406
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/k8s.contrib.crd/PklProject
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ dependencies {
}

package {
version = "1.0.3"
version = "1.0.4"
}
6 changes: 3 additions & 3 deletions packages/k8s.contrib.crd/PklProject.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"package://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1.0.4",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1.0.5",
"path": "../org.json_schema.contrib"
},
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": {
Expand All @@ -25,12 +25,12 @@
},
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.0",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.1",
"path": "../pkl.experimental.uri"
},
"package://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.0.1",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.0.2",
"path": "../org.json_schema"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/org.json_schema.contrib/PklProject
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ dependencies {
}

package {
version = "1.0.4"
version = "1.0.5"
}
4 changes: 2 additions & 2 deletions packages/org.json_schema.contrib/PklProject.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.0",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.1",
"path": "../pkl.experimental.uri"
},
"package://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.0.1",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.0.2",
"path": "../org.json_schema"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/org.json_schema/PklProject
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dependencies {
}

package {
version = "1.0.1"
version = "1.0.2"
}
2 changes: 1 addition & 1 deletion packages/org.json_schema/PklProject.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"resolvedDependencies": {
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": {
"type": "local",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.0",
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.1",
"path": "../pkl.experimental.uri"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pkl.experimental.uri/PklProject
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
amends "../basePklProject.pkl"

package {
version = "1.0.0"
version = "1.0.1"
}
2 changes: 1 addition & 1 deletion packages/pkl.experimental.uri/URI.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ local function getUtf8Bytes(codePoint: Int): List<UInt8> =
/// ```
local function percentEncode(codePoint: Int) =
getUtf8Bytes(codePoint)
.map((it) -> "%" + it.toRadixString(16).toUpperCase())
.map((it) -> "%" + it.toRadixString(16).toUpperCase().padStart(2, "0"))
.join("")

local hexDigits = "0123456789ABCDEF"
Expand Down
1 change: 1 addition & 0 deletions packages/pkl.experimental.uri/tests/URI.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ facts {
URI.encode(safeChars) == safeChars
URI.encode("\u{ffff}") == "%EF%BF%BF"
URI.encode("🏀") == "%F0%9F%8F%80"
URI.encode("\n") == "%0A"
}
["encodeComponent"] {
URI.encodeComponent("https://example.com/some path") == "https%3A%2F%2Fexample.com%2Fsome%20path"
Expand Down

0 comments on commit 2387406

Please sign in to comment.