We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 078e2f1 commit 80f7cfeCopy full SHA for 80f7cfe
1 file changed
astro/src/plugins/static-redirects.ts
@@ -144,8 +144,18 @@ async function detectDuplicateRedirects(
144
? frontmatter.redirect_from
145
: [frontmatter.redirect_from];
146
147
+ const normalizeRedirectSource = (source: string) => {
148
+ const trimmed = source.trim();
149
+ if (trimmed !== source) {
150
+ logger.warn(
151
+ `Trimmed whitespace from redirect_from entry in ${file}: ${JSON.stringify(source)} -> ${JSON.stringify(trimmed)}`,
152
+ );
153
+ }
154
+ return trimmed.endsWith("/") ? trimmed.slice(0, -1) : trimmed;
155
+ };
156
+
157
for (const source of redirectFrom) {
- const normalized = source.endsWith("/") ? source.slice(0, -1) : source;
158
+ const normalized = normalizeRedirectSource(source);
159
const existing = sourceToFiles.get(normalized);
160
if (existing) {
161
existing.push(file);
0 commit comments