FIX: support /my routes with subfolders

This commit is contained in:
Neil Lalonde 2017-10-31 15:46:03 -04:00
parent aee316c6ff
commit e7d8f5f9c8

View File

@ -193,10 +193,10 @@ const DiscourseURL = Ember.Object.extend({
path = path.replace(/(https?\:)?\/\/[^\/]+/, ''); path = path.replace(/(https?\:)?\/\/[^\/]+/, '');
// Rewrite /my/* urls // Rewrite /my/* urls
if (path.indexOf('/my/') === 0) { if (path.indexOf(Discourse.BaseUri + '/my/') === 0) {
const currentUser = Discourse.User.current(); const currentUser = Discourse.User.current();
if (currentUser) { if (currentUser) {
path = path.replace('/my/', userPath(currentUser.get('username_lower') + "/")); path = path.replace(Discourse.BaseUri + '/my/', userPath(currentUser.get('username_lower') + "/"));
} else { } else {
document.location.href = "/404"; document.location.href = "/404";
return; return;