astro 7.1.0 → 7.1.1
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/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/fetch/fetch-state.js +25 -19
- package/dist/core/i18n/domain.d.ts +1 -1
- package/dist/core/i18n/domain.js +4 -5
- package/dist/core/messages/runtime.js +1 -1
- package/package.json +1 -1
|
@@ -196,7 +196,7 @@ ${contentConfig.error.message}`
|
|
|
196
196
|
logger.info("Content config changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
199
|
-
if (previousAstroVersion && previousAstroVersion !== "7.1.
|
|
199
|
+
if (previousAstroVersion && previousAstroVersion !== "7.1.1") {
|
|
200
200
|
logger.info("Astro version changed");
|
|
201
201
|
shouldClear = true;
|
|
202
202
|
}
|
|
@@ -204,8 +204,8 @@ ${contentConfig.error.message}`
|
|
|
204
204
|
logger.info("Clearing content store");
|
|
205
205
|
this.#store.clearAll();
|
|
206
206
|
}
|
|
207
|
-
if ("7.1.
|
|
208
|
-
this.#store.metaStore().set("astro-version", "7.1.
|
|
207
|
+
if ("7.1.1") {
|
|
208
|
+
this.#store.metaStore().set("astro-version", "7.1.1");
|
|
209
209
|
}
|
|
210
210
|
if (currentConfigDigest) {
|
|
211
211
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -26,7 +26,7 @@ async function dev(inlineConfig) {
|
|
|
26
26
|
await telemetry.record([]);
|
|
27
27
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
28
28
|
const logger = restart.container.logger;
|
|
29
|
-
const currentVersion = "7.1.
|
|
29
|
+
const currentVersion = "7.1.1";
|
|
30
30
|
const isPrerelease = currentVersion.includes("-");
|
|
31
31
|
if (!isPrerelease) {
|
|
32
32
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import colors from "piccolore";
|
|
2
2
|
import {
|
|
3
3
|
collapseDuplicateLeadingSlashes,
|
|
4
|
+
collapseDuplicateSlashes,
|
|
4
5
|
prependForwardSlash,
|
|
5
6
|
removeTrailingForwardSlash
|
|
6
7
|
} from "@astrojs/internal-helpers/path";
|
|
@@ -28,7 +29,6 @@ import {
|
|
|
28
29
|
import { getParams, getProps } from "../render/index.js";
|
|
29
30
|
import { Rewrites } from "../rewrites/handler.js";
|
|
30
31
|
import { isRoute404or500, isRouteServerIsland } from "../routing/match.js";
|
|
31
|
-
import { normalizeUrl } from "../util/normalized-url.js";
|
|
32
32
|
import { MultiLevelEncodingError, validateAndDecodePathname } from "../util/pathname.js";
|
|
33
33
|
import { getOriginPathname, setOriginPathname } from "../routing/rewrite.js";
|
|
34
34
|
import { computePathnameFromDomain } from "../i18n/domain.js";
|
|
@@ -178,28 +178,29 @@ class FetchState {
|
|
|
178
178
|
this.componentInstance = void 0;
|
|
179
179
|
this.slots = void 0;
|
|
180
180
|
const url = new URL(request.url);
|
|
181
|
+
const publicPathname = this.#normalizePathname(url.pathname);
|
|
182
|
+
const pathname = this.#computePathname(publicPathname);
|
|
183
|
+
url.pathname = publicPathname;
|
|
184
|
+
url.pathname = collapseDuplicateSlashes(url.pathname);
|
|
181
185
|
const domainPathname = computePathnameFromDomain(
|
|
182
186
|
request,
|
|
183
187
|
url,
|
|
184
188
|
pipeline.manifest.i18n,
|
|
185
189
|
pipeline.manifest.base,
|
|
186
190
|
pipeline.manifest.trailingSlash,
|
|
187
|
-
pipeline.logger
|
|
191
|
+
pipeline.logger,
|
|
192
|
+
pathname
|
|
188
193
|
);
|
|
189
194
|
if (domainPathname) {
|
|
190
195
|
this.#domainPathname = domainPathname;
|
|
191
|
-
|
|
192
|
-
this.pathname = decodeURI(domainPathname);
|
|
193
|
-
} catch {
|
|
194
|
-
this.pathname = domainPathname;
|
|
195
|
-
}
|
|
196
|
+
this.pathname = domainPathname;
|
|
196
197
|
} else {
|
|
197
|
-
this.pathname =
|
|
198
|
+
this.pathname = pathname;
|
|
198
199
|
}
|
|
199
200
|
this.timeStart = performance.now();
|
|
200
201
|
this.clientAddress = options?.clientAddress;
|
|
201
202
|
this.locals = options?.locals ?? {};
|
|
202
|
-
this.url =
|
|
203
|
+
this.url = url;
|
|
203
204
|
this.cookies = new AstroCookies(request);
|
|
204
205
|
if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0 && !this.routeData?.prerender) {
|
|
205
206
|
this.#applyForwardedHeaders();
|
|
@@ -732,32 +733,37 @@ class FetchState {
|
|
|
732
733
|
this.#stripHtmlExtension();
|
|
733
734
|
}
|
|
734
735
|
/**
|
|
735
|
-
* Strips the pipeline's base from
|
|
736
|
-
*
|
|
737
|
-
* pathname if `decodeURI` throws.
|
|
736
|
+
* Strips the pipeline's base from a normalized request pathname and prepends
|
|
737
|
+
* a forward slash.
|
|
738
738
|
*
|
|
739
739
|
* Mirrors `BaseApp.removeBase`, including the
|
|
740
740
|
* `collapseDuplicateLeadingSlashes` fix that prevents middleware
|
|
741
741
|
* authorization bypass when the URL starts with `//`.
|
|
742
742
|
*/
|
|
743
|
-
#computePathname(
|
|
744
|
-
let pathname = collapseDuplicateLeadingSlashes(
|
|
743
|
+
#computePathname(normalizedPathname) {
|
|
744
|
+
let pathname = collapseDuplicateLeadingSlashes(normalizedPathname);
|
|
745
745
|
const base = this.pipeline.manifest.base;
|
|
746
746
|
if (pathname.startsWith(base)) {
|
|
747
747
|
const baseWithoutTrailingSlash = removeTrailingForwardSlash(base);
|
|
748
748
|
pathname = pathname.slice(baseWithoutTrailingSlash.length + 1);
|
|
749
749
|
}
|
|
750
|
-
|
|
750
|
+
return prependForwardSlash(pathname);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Decodes and normalizes the public request pathname before deriving the
|
|
754
|
+
* separate pathname used for route matching.
|
|
755
|
+
*/
|
|
756
|
+
#normalizePathname(pathname) {
|
|
751
757
|
try {
|
|
752
|
-
|
|
758
|
+
pathname = validateAndDecodePathname(pathname);
|
|
753
759
|
} catch (e) {
|
|
754
760
|
if (e instanceof MultiLevelEncodingError) {
|
|
755
761
|
this.invalidEncoding = true;
|
|
756
|
-
|
|
762
|
+
} else {
|
|
763
|
+
this.pipeline.logger.error(null, e.toString());
|
|
757
764
|
}
|
|
758
|
-
this.pipeline.logger.error(null, e.toString());
|
|
759
|
-
return pathname;
|
|
760
765
|
}
|
|
766
|
+
return collapseDuplicateSlashes(pathname);
|
|
761
767
|
}
|
|
762
768
|
/**
|
|
763
769
|
* Reads X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port
|
|
@@ -9,4 +9,4 @@ import type { AstroLogger } from '../logger/core.js';
|
|
|
9
9
|
* mapped to a locale — in which case normal pathname routing applies.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
export declare function computePathnameFromDomain(request: Request, url: URL, i18n: SSRManifest['i18n'], base: SSRManifest['base'], trailingSlash: SSRManifest['trailingSlash'], logger: AstroLogger): string | undefined;
|
|
12
|
+
export declare function computePathnameFromDomain(request: Request, url: URL, i18n: SSRManifest['i18n'], base: SSRManifest['base'], trailingSlash: SSRManifest['trailingSlash'], logger: AstroLogger, pathnameFromRequest?: string): string | undefined;
|
package/dist/core/i18n/domain.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
removeTrailingForwardSlash
|
|
7
7
|
} from "@astrojs/internal-helpers/path";
|
|
8
8
|
import { normalizeTheLocale } from "../../i18n/path.js";
|
|
9
|
-
function computePathnameFromDomain(request, url, i18n, base, trailingSlash, logger) {
|
|
9
|
+
function computePathnameFromDomain(request, url, i18n, base, trailingSlash, logger, pathnameFromRequest) {
|
|
10
10
|
let pathname = void 0;
|
|
11
11
|
if (i18n && (i18n.strategy === "domains-prefix-always" || i18n.strategy === "domains-prefix-other-locales" || i18n.strategy === "domains-prefix-always-no-redirect")) {
|
|
12
12
|
let host = request.headers.get("X-Forwarded-Host");
|
|
@@ -32,14 +32,13 @@ function computePathnameFromDomain(request, url, i18n, base, trailingSlash, logg
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (locale) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
35
|
+
const requestPathname = pathnameFromRequest ?? removeBase(url.pathname, base);
|
|
36
|
+
pathname = prependForwardSlash(joinPaths(normalizeTheLocale(locale), requestPathname));
|
|
38
37
|
if (trailingSlash === "always") {
|
|
39
38
|
pathname = appendForwardSlash(pathname);
|
|
40
39
|
} else if (trailingSlash === "never") {
|
|
41
40
|
pathname = removeTrailingForwardSlash(pathname);
|
|
42
|
-
} else if (
|
|
41
|
+
} else if (requestPathname.endsWith("/")) {
|
|
43
42
|
pathname = appendForwardSlash(pathname);
|
|
44
43
|
}
|
|
45
44
|
}
|