Skip to content

Commit

Permalink
Fix double slash redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
brookslybrand committed Aug 15, 2024
1 parent 3dccfd6 commit b7559c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/lib/http.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export function safeRedirect(
export function removeTrailingSlashes(request: Request) {
let url = new URL(request.url);
if (url.pathname.endsWith("/") && url.pathname !== "/") {
throw redirect(url.pathname.slice(0, -1) + url.search);
url.pathname = url.pathname.slice(0, -1);
throw redirect(url.toString());
}
}

Expand Down

0 comments on commit b7559c4

Please sign in to comment.