FIX: removes extra slashes from URL (#11433)

This is similar to a fix used in ember core: https://github.com/emberjs/ember.js/blob/master/packages/@ember/-internals/routing/lib/location/history_location.ts#L140

It will prevent a URL with a double slash to hang and end up in a 404.
This commit is contained in:
Joffrey JAFFEUX 2020-12-08 17:47:43 +01:00 committed by GitHub
parent 7a079b9e3b
commit b824af02d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -66,6 +66,7 @@ const DiscourseLocation = EmberObject.extend({
let url = withoutPrefix(this.location.pathname);
const search = this.location.search || "";
url += search;
url = url.replace(/\/\//g, "/"); // remove extra slashes
return url;
},