Skip to content

Commit 8992142

Browse files
konojunyabluwy
andauthored
fix(astro/core): Do not automatically add trailing slash (#5608)
* fix: Do not automatically add trailing slash * Update .changeset/twelve-cooks-tickle.md Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * fix: change semver Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
1 parent 35b26f3 commit 8992142

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.changeset/twelve-cooks-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': major
3+
---
4+
5+
A trailing slash will not be automatically appended to `import.meta.env.SITE`. Instead, it will be the value of the `site` config as is. This may affect usages of `${import.meta.env.SITE}image.png`, which will need to be updated accordingly.

packages/astro/src/core/config/schema.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ export const AstroConfigSchema = z.object({
5757
.optional()
5858
.default(ASTRO_CONFIG_DEFAULTS.outDir)
5959
.transform((val) => new URL(val)),
60-
site: z
61-
.string()
62-
.url()
63-
.optional()
64-
.transform((val) => (val ? appendForwardSlash(val) : val)),
60+
site: z.string().url().optional(),
6561
base: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.base),
6662
trailingSlash: z
6763
.union([z.literal('always'), z.literal('never'), z.literal('ignore')])

0 commit comments

Comments
 (0)