From b824af02d452e2d907690d1743b1b40eedb7667c Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 8 Dec 2020 17:47:43 +0100 Subject: [PATCH] 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. --- app/assets/javascripts/discourse/app/lib/discourse-location.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/discourse/app/lib/discourse-location.js b/app/assets/javascripts/discourse/app/lib/discourse-location.js index 0dff2254c3f..f026de6b919 100644 --- a/app/assets/javascripts/discourse/app/lib/discourse-location.js +++ b/app/assets/javascripts/discourse/app/lib/discourse-location.js @@ -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; },