Skip to content

Commit c8056b1

Browse files
committed
fix: support trailing slash
1 parent c164fea commit c8056b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/create-react-app-server/src/routes/createReactApp.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ export default async ({ req, res, next, options }) => {
101101
});
102102

103103
if (head || html) {
104-
const filename = !isHome ? `${url}.html` : '/home.html';
104+
const lastCharacter = url[url.length - 1];
105+
106+
// ensure we support urls with trailing forward slash
107+
const urlFilename = lastCharacter !== '/'
108+
? url
109+
: `${url}_`;
110+
111+
const filename = !isHome ? `${urlFilename}.html` : '/home.html';
105112
const path = `${options.craBuildPath}${filename}`;
106113

107114
// match puppeteer script tag identifier

0 commit comments

Comments
 (0)