Skip to content

Commit 168fcdb

Browse files
committed
remove extraneous slashes
1 parent 297edf8 commit 168fcdb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/adapter-vercel/files/serverless.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ export default async (req, res) => {
2222
const [path, search] = req.url.split('?');
2323

2424
const params = new URLSearchParams(search);
25-
const pathname = params.get('__pathname');
25+
let pathname = params.get('__pathname');
2626

2727
if (pathname) {
2828
params.delete('__pathname');
29+
// Optional routes' pathname replacements look like `/foo/$1/bar` which means we could end up with an url like /foo//bar
30+
pathname = pathname.replace(/\/+/g, '/');
2931
req.url = `${pathname}${path.endsWith(DATA_SUFFIX) ? DATA_SUFFIX : ''}?${params}`;
3032
}
3133
}

0 commit comments

Comments
 (0)