Skip to content

Commit e7733e8

Browse files
authored
Merge pull request #339 from kellyselden/rootURL
path needs rootURL massaging earlier to pass the isTransitioning check
2 parents f75c3fd + be8fdd6 commit e7733e8

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

app/locations/none.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,28 @@ export default Ember.NoneLocation.extend({
2727
_response: readOnly('fastboot.response'),
2828
_request: readOnly('fastboot.request'),
2929

30+
_normalizePath(path, isInitialPath) {
31+
if (!isInitialPath) {
32+
// only on redirects (transitionTo, replaceWith, etc...)
33+
// incoming path does not include rootURL
34+
let rootURL = get(this, 'rootURL');
35+
rootURL = rootURL.substr(0, rootURL.length - 1);
36+
path = `${rootURL}${path}`;
37+
}
38+
return path;
39+
},
40+
3041
setURL(path) {
3142
if (get(this, 'fastboot.isFastBoot')) {
3243
let currentPath = get(this, 'path');
3344
let isInitialPath = !currentPath || currentPath.length === 0;
45+
path = this._normalizePath(path, isInitialPath);
3446
let isTransitioning = currentPath !== path;
3547
let response = get(this, '_response');
3648

3749
if (isTransitioning && !isInitialPath) {
3850
let protocol = get(this, '_request.protocol');
3951
let host = get(this, '_request.host');
40-
let rootURL = get(this, 'rootURL');
41-
rootURL = rootURL.substr(0, rootURL.length - 1);
42-
path = `${rootURL}${path}`;
4352
let redirectURL = `${protocol}://${host}${path}`;
4453

4554
response.statusCode = this.get('_redirectCode');

0 commit comments

Comments
 (0)