FIX: wrong root path on subfolder installs

This commit is contained in:
Neil Lalonde 2015-10-21 13:13:19 -04:00
parent 1821ba8d93
commit ca98f66f7e
2 changed files with 8 additions and 1 deletions

View File

@ -14,7 +14,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
if (!url) return url;
// if it's a non relative URL, return it.
if (!/^\/[^\/]/.test(url)) return url;
if (url !== '/' && !/^\/[^\/]/.test(url)) return url;
var u = Discourse.BaseUri === undefined ? "/" : Discourse.BaseUri;

View File

@ -0,0 +1,7 @@
module("lib:discourse");
test("getURL on subfolder install", function() {
Discourse.BaseUri = "/forum";
equal(Discourse.getURL("/"), "/forum/", "root url has subfolder");
equal(Discourse.getURL("/users/neil"), "/forum/users/neil", "relative url has subfolder");
});