FIX: Replace `/my/` URLs before fixing the prefix

This commit is contained in:
Robin Ward 2017-06-08 16:21:29 -04:00
parent 33e3746d4d
commit 8e2e962b1a
1 changed files with 7 additions and 7 deletions

View File

@ -191,13 +191,6 @@ const DiscourseURL = Ember.Object.extend({
const oldPath = window.location.pathname; const oldPath = window.location.pathname;
path = path.replace(/(https?\:)?\/\/[^\/]+/, ''); 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 // Rewrite /my/* urls
if (path.indexOf('/my/') === 0) { if (path.indexOf('/my/') === 0) {
const currentUser = Discourse.User.current(); 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); path = rewritePath(path);
if (this.navigatedToPost(oldPath, path, opts)) { return; } if (this.navigatedToPost(oldPath, path, opts)) { return; }