| class BuildTimeAstroVersionProvider { | ||
| // Injected during the build through esbuild define | ||
| version = "7.1.0"; | ||
| version = "7.1.1"; | ||
| } | ||
@@ -5,0 +5,0 @@ export { |
@@ -199,3 +199,3 @@ import { existsSync, promises as fs } from "node:fs"; | ||
| } | ||
| if (previousAstroVersion && previousAstroVersion !== "7.1.0") { | ||
| if (previousAstroVersion && previousAstroVersion !== "7.1.1") { | ||
| logger.info("Astro version changed"); | ||
@@ -208,4 +208,4 @@ shouldClear = true; | ||
| } | ||
| if ("7.1.0") { | ||
| this.#store.metaStore().set("astro-version", "7.1.0"); | ||
| if ("7.1.1") { | ||
| this.#store.metaStore().set("astro-version", "7.1.1"); | ||
| } | ||
@@ -212,0 +212,0 @@ if (currentConfigDigest) { |
@@ -1,2 +0,2 @@ | ||
| const ASTRO_VERSION = "7.1.0"; | ||
| const ASTRO_VERSION = "7.1.1"; | ||
| const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`; | ||
@@ -3,0 +3,0 @@ const ASTRO_ERROR_HEADER = "X-Astro-Error"; |
@@ -29,3 +29,3 @@ import fs from "node:fs"; | ||
| const logger = restart.container.logger; | ||
| const currentVersion = "7.1.0"; | ||
| const currentVersion = "7.1.1"; | ||
| const isPrerelease = currentVersion.includes("-"); | ||
@@ -32,0 +32,0 @@ if (!isPrerelease) { |
| import colors from "piccolore"; | ||
| import { | ||
| collapseDuplicateLeadingSlashes, | ||
| collapseDuplicateSlashes, | ||
| prependForwardSlash, | ||
@@ -31,3 +32,2 @@ removeTrailingForwardSlash | ||
| import { isRoute404or500, isRouteServerIsland } from "../routing/match.js"; | ||
| import { normalizeUrl } from "../util/normalized-url.js"; | ||
| import { MultiLevelEncodingError, validateAndDecodePathname } from "../util/pathname.js"; | ||
@@ -182,2 +182,6 @@ import { getOriginPathname, setOriginPathname } from "../routing/rewrite.js"; | ||
| const url = new URL(request.url); | ||
| const publicPathname = this.#normalizePathname(url.pathname); | ||
| const pathname = this.#computePathname(publicPathname); | ||
| url.pathname = publicPathname; | ||
| url.pathname = collapseDuplicateSlashes(url.pathname); | ||
| const domainPathname = computePathnameFromDomain( | ||
@@ -189,13 +193,10 @@ request, | ||
| pipeline.manifest.trailingSlash, | ||
| pipeline.logger | ||
| pipeline.logger, | ||
| pathname | ||
| ); | ||
| if (domainPathname) { | ||
| this.#domainPathname = domainPathname; | ||
| try { | ||
| this.pathname = decodeURI(domainPathname); | ||
| } catch { | ||
| this.pathname = domainPathname; | ||
| } | ||
| this.pathname = domainPathname; | ||
| } else { | ||
| this.pathname = this.#computePathname(url); | ||
| this.pathname = pathname; | ||
| } | ||
@@ -205,3 +206,3 @@ this.timeStart = performance.now(); | ||
| this.locals = options?.locals ?? {}; | ||
| this.url = normalizeUrl(url); | ||
| this.url = url; | ||
| this.cookies = new AstroCookies(request); | ||
@@ -739,5 +740,4 @@ if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0 && !this.routeData?.prerender) { | ||
| /** | ||
| * Strips the pipeline's base from the request URL, prepends a forward | ||
| * slash, and decodes the pathname. Falls back to the raw (not decoded) | ||
| * pathname if `decodeURI` throws. | ||
| * Strips the pipeline's base from a normalized request pathname and prepends | ||
| * a forward slash. | ||
| * | ||
@@ -748,4 +748,4 @@ * Mirrors `BaseApp.removeBase`, including the | ||
| */ | ||
| #computePathname(url) { | ||
| let pathname = collapseDuplicateLeadingSlashes(url.pathname); | ||
| #computePathname(normalizedPathname) { | ||
| let pathname = collapseDuplicateLeadingSlashes(normalizedPathname); | ||
| const base = this.pipeline.manifest.base; | ||
@@ -756,13 +756,19 @@ if (pathname.startsWith(base)) { | ||
| } | ||
| pathname = prependForwardSlash(pathname); | ||
| return prependForwardSlash(pathname); | ||
| } | ||
| /** | ||
| * Decodes and normalizes the public request pathname before deriving the | ||
| * separate pathname used for route matching. | ||
| */ | ||
| #normalizePathname(pathname) { | ||
| try { | ||
| return validateAndDecodePathname(pathname); | ||
| pathname = validateAndDecodePathname(pathname); | ||
| } catch (e) { | ||
| if (e instanceof MultiLevelEncodingError) { | ||
| this.invalidEncoding = true; | ||
| return pathname; | ||
| } else { | ||
| this.pipeline.logger.error(null, e.toString()); | ||
| } | ||
| this.pipeline.logger.error(null, e.toString()); | ||
| return pathname; | ||
| } | ||
| return collapseDuplicateSlashes(pathname); | ||
| } | ||
@@ -769,0 +775,0 @@ /** |
@@ -12,2 +12,2 @@ import type { SSRManifest } from '../app/types.js'; | ||
| */ | ||
| export declare function computePathnameFromDomain(request: Request, url: URL, i18n: SSRManifest['i18n'], base: SSRManifest['base'], trailingSlash: SSRManifest['trailingSlash'], logger: AstroLogger): string | undefined; | ||
| export declare function computePathnameFromDomain(request: Request, url: URL, i18n: SSRManifest['i18n'], base: SSRManifest['base'], trailingSlash: SSRManifest['trailingSlash'], logger: AstroLogger, pathnameFromRequest?: string): string | undefined; |
@@ -9,3 +9,3 @@ import { | ||
| import { normalizeTheLocale } from "../../i18n/path.js"; | ||
| function computePathnameFromDomain(request, url, i18n, base, trailingSlash, logger) { | ||
| function computePathnameFromDomain(request, url, i18n, base, trailingSlash, logger, pathnameFromRequest) { | ||
| let pathname = void 0; | ||
@@ -36,5 +36,4 @@ if (i18n && (i18n.strategy === "domains-prefix-always" || i18n.strategy === "domains-prefix-other-locales" || i18n.strategy === "domains-prefix-always-no-redirect")) { | ||
| if (locale) { | ||
| pathname = prependForwardSlash( | ||
| joinPaths(normalizeTheLocale(locale), removeBase(url.pathname, base)) | ||
| ); | ||
| const requestPathname = pathnameFromRequest ?? removeBase(url.pathname, base); | ||
| pathname = prependForwardSlash(joinPaths(normalizeTheLocale(locale), requestPathname)); | ||
| if (trailingSlash === "always") { | ||
@@ -44,3 +43,3 @@ pathname = appendForwardSlash(pathname); | ||
| pathname = removeTrailingForwardSlash(pathname); | ||
| } else if (url.pathname.endsWith("/")) { | ||
| } else if (requestPathname.endsWith("/")) { | ||
| pathname = appendForwardSlash(pathname); | ||
@@ -47,0 +46,0 @@ } |
@@ -273,3 +273,3 @@ import colors from "piccolore"; | ||
| ` ${bgGreen(black(` ${commandName} `))} ${green( | ||
| `v${"7.1.0"}` | ||
| `v${"7.1.1"}` | ||
| )} ${headline}` | ||
@@ -276,0 +276,0 @@ ); |
+1
-1
| { | ||
| "name": "astro", | ||
| "version": "7.1.0", | ||
| "version": "7.1.1", | ||
| "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2873622
0.01%75355
0.01%