Skip to content

Commit

Permalink
Update location to handle pre-existing trailing slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
kategengler committed Dec 17, 2024
1 parent 2d3ce8d commit 947d419
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/locations/trailing-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default HistoryLocation.extend({

export function formatURL(url) {
let modifiedURL = new URL(url, 'http://example.com');
modifiedURL.pathname += '/';
if (!modifiedURL.pathname.endsWith('/')) {
modifiedURL.pathname += '/';
}
return `${modifiedURL.pathname}${modifiedURL.search}${modifiedURL.hash}`;
}

0 comments on commit 947d419

Please sign in to comment.