Skip to content

Commit 947d419

Browse files
committed
Update location to handle pre-existing trailing slashes
1 parent 2d3ce8d commit 947d419

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/locations/trailing-history.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default HistoryLocation.extend({
1414

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

0 commit comments

Comments
 (0)