From 8e2e962b1accffadad8527d0ae94f9271bd57de0 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 8 Jun 2017 16:21:29 -0400 Subject: [PATCH] FIX: Replace `/my/` URLs before fixing the prefix --- app/assets/javascripts/discourse/lib/url.js.es6 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 1d74f02eccb..5ce1cfa9b34 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -191,13 +191,6 @@ const DiscourseURL = Ember.Object.extend({ const oldPath = window.location.pathname; path = path.replace(/(https?\:)?\/\/[^\/]+/, ''); - // handle prefixes - if (path.match(/^\//)) { - let rootURL = (Discourse.BaseUri === undefined ? "/" : Discourse.BaseUri); - rootURL = rootURL.replace(/\/$/, ''); - path = path.replace(rootURL, ''); - } - // Rewrite /my/* urls if (path.indexOf('/my/') === 0) { const currentUser = Discourse.User.current(); @@ -209,6 +202,13 @@ const DiscourseURL = Ember.Object.extend({ } } + // handle prefixes + if (path.match(/^\//)) { + let rootURL = (Discourse.BaseUri === undefined ? "/" : Discourse.BaseUri); + rootURL = rootURL.replace(/\/$/, ''); + path = path.replace(rootURL, ''); + } + path = rewritePath(path); if (this.navigatedToPost(oldPath, path, opts)) { return; }