Skip to content

Commit 1bb44ca

Browse files
fix: append trailing slash in manifest (#1507)
* fix: normalize trailing slash in prerender (#1486) * this is a camelCase-free zone, except for public APIs Co-authored-by: Rich Harris <[email protected]>
1 parent b0e6296 commit 1bb44ca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/kit/src/core/adapt/prerender.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,26 @@ export async function prerender({ cwd, out, log, config, build_data, fallback, a
9090
}
9191
});
9292

93+
/**
94+
* @param {string} path
95+
*/
96+
function normalize(path) {
97+
if (config.kit.trailingSlash === 'always') {
98+
return path.endsWith('/') ? path : `${path}/`;
99+
} else if (config.kit.trailingSlash === 'never') {
100+
return !path.endsWith('/') || path === '/' ? path : path.slice(0, -1);
101+
}
102+
103+
return path;
104+
}
105+
93106
/**
94107
* @param {string} path
95108
* @param {string} parent
96109
*/
97110
async function visit(path, parent) {
111+
path = normalize(path);
112+
98113
if (seen.has(path)) return;
99114
seen.add(path);
100115

0 commit comments

Comments
 (0)