@void/edge 1.1.0 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +12 -6
- package/dist/index.mjs +9 -7
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -158,6 +158,11 @@ type StaticEdgeEnv = Readonly<{
|
|
|
158
158
|
type StaticEdgeConfig = Readonly<{
|
|
159
159
|
/** Optional native Worker self-metadata used to identify the served version. */
|
|
160
160
|
versionMetadataBinding?: string;
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Ignored. Cloudflare applies asset handling from the Worker's
|
|
163
|
+
* `assets` config (`not_found_handling`, `html_handling`), which `void deploy`
|
|
164
|
+
* writes. Removed in the next major version.
|
|
165
|
+
*/
|
|
161
166
|
assetConfig?: AssetConfig$1;
|
|
162
167
|
headerRules?: ReadonlyArray<HeaderRule$1>;
|
|
163
168
|
redirectRules?: ReadonlyArray<RedirectRule$1>;
|
|
@@ -183,10 +188,9 @@ type ResolvedAsset = Readonly<{
|
|
|
183
188
|
spa?: boolean;
|
|
184
189
|
}>;
|
|
185
190
|
/**
|
|
186
|
-
* Percent-decode a request pathname for a manifest lookup, honoring
|
|
187
|
-
* encodings
|
|
188
|
-
*
|
|
189
|
-
* over-encoded spelling.
|
|
191
|
+
* Percent-decode a request pathname for a manifest lookup, honoring required
|
|
192
|
+
* URL encodings and encoded square brackets. Returns the raw value unchanged
|
|
193
|
+
* on a malformed sequence (e.g. a lone `%`) or other over-encoded spellings.
|
|
190
194
|
*
|
|
191
195
|
* Request pathnames arrive percent-encoded — WHATWG `URL.pathname` never
|
|
192
196
|
* decodes — but manifest keys are the asset's decoded on-disk path (a file
|
|
@@ -194,8 +198,10 @@ type ResolvedAsset = Readonly<{
|
|
|
194
198
|
* `%20`). Callers try the raw key first, then this decoded form.
|
|
195
199
|
*
|
|
196
200
|
* The decoded form is accepted only when re-encoding it reproduces the request
|
|
197
|
-
* path (up to percent-escape letter case
|
|
198
|
-
*
|
|
201
|
+
* path (up to percent-escape letter case and square-bracket encoding). Next.js
|
|
202
|
+
* encodes brackets in dynamic-page chunk URLs even though URL.pathname leaves
|
|
203
|
+
* them literal. Other accepted escapes are characters a URL MUST encode
|
|
204
|
+
* (space, `#`, non-ASCII, …). This rejects
|
|
199
205
|
* over-encoded spellings of ordinary path text (`%2F`→`/`, `%61`→`a`, `%5F`→`_`,
|
|
200
206
|
* `%2e%2e`→`..`), which a browser would never send and which would otherwise let
|
|
201
207
|
* a request reconstruct a guarded path (`/assets%2Fx`, `/%61ssets/x`,
|
package/dist/index.mjs
CHANGED
|
@@ -602,10 +602,9 @@ function rewriteRequest(request, url, originalUrl) {
|
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region src/static.ts
|
|
604
604
|
/**
|
|
605
|
-
* Percent-decode a request pathname for a manifest lookup, honoring
|
|
606
|
-
* encodings
|
|
607
|
-
*
|
|
608
|
-
* over-encoded spelling.
|
|
605
|
+
* Percent-decode a request pathname for a manifest lookup, honoring required
|
|
606
|
+
* URL encodings and encoded square brackets. Returns the raw value unchanged
|
|
607
|
+
* on a malformed sequence (e.g. a lone `%`) or other over-encoded spellings.
|
|
609
608
|
*
|
|
610
609
|
* Request pathnames arrive percent-encoded — WHATWG `URL.pathname` never
|
|
611
610
|
* decodes — but manifest keys are the asset's decoded on-disk path (a file
|
|
@@ -613,8 +612,10 @@ function rewriteRequest(request, url, originalUrl) {
|
|
|
613
612
|
* `%20`). Callers try the raw key first, then this decoded form.
|
|
614
613
|
*
|
|
615
614
|
* The decoded form is accepted only when re-encoding it reproduces the request
|
|
616
|
-
* path (up to percent-escape letter case
|
|
617
|
-
*
|
|
615
|
+
* path (up to percent-escape letter case and square-bracket encoding). Next.js
|
|
616
|
+
* encodes brackets in dynamic-page chunk URLs even though URL.pathname leaves
|
|
617
|
+
* them literal. Other accepted escapes are characters a URL MUST encode
|
|
618
|
+
* (space, `#`, non-ASCII, …). This rejects
|
|
618
619
|
* over-encoded spellings of ordinary path text (`%2F`→`/`, `%61`→`a`, `%5F`→`_`,
|
|
619
620
|
* `%2e%2e`→`..`), which a browser would never send and which would otherwise let
|
|
620
621
|
* a request reconstruct a guarded path (`/assets%2Fx`, `/%61ssets/x`,
|
|
@@ -638,7 +639,8 @@ function safeDecodePathname(pathname) {
|
|
|
638
639
|
if (decoded === pathname) return pathname;
|
|
639
640
|
const canonical = reencodePathname(decoded);
|
|
640
641
|
if (canonical === null) return pathname;
|
|
641
|
-
|
|
642
|
+
const normalized = normalizePercentCase(pathname).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
|
643
|
+
return normalizePercentCase(canonical) === normalized ? decoded : pathname;
|
|
642
644
|
}
|
|
643
645
|
/** Uppercase the hex digits of every `%xx` escape so encodings compare equal
|
|
644
646
|
* regardless of the letter case a client used. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/edge",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "Routing, headers, and static asset helpers for Void runtimes.",
|
|
5
5
|
"homepage": "https://void.cloud",
|
|
6
6
|
"bugs": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@void/deploy-core": "1.1.
|
|
29
|
+
"@void/deploy-core": "1.1.12"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@cloudflare/workers-types": "^5.20261014.1",
|