Skip to content

Commit

Permalink
[BUGFIX beta] Fix routing path with double slash (#18226)
Browse files Browse the repository at this point in the history
[BUGFIX beta] Fix routing path with double slash
  • Loading branch information
rwjblue authored Aug 4, 2019
2 parents a1b5a6b + b70a442 commit e8a6420
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class HistoryLocation extends EmberObject implements EmberLocatio
let url = path
.replace(new RegExp(`^${baseURL}(?=/|$)`), '')
.replace(new RegExp(`^${rootURL}(?=/|$)`), '')
.replace(/\/\/$/g, '/'); // remove extra slashes
.replace(/\/\//g, '/'); // remove extra slashes

let search = location.search || '';
url += search + this.getHash();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ moduleFor(
HistoryTestLocation.reopen({
init() {
this._super(...arguments);
let location = mockBrowserLocation('//');
location.pathname = '//'; // mockBrowserLocation does not allow for `//`, so force it
let location = mockBrowserLocation('//admin//profile//');
location.pathname = '//admin//profile//'; // mockBrowserLocation does not allow for `//`, so force it
set(this, 'location', location);
},
});

createLocation();

assert.equal(location.getURL(), '/');
assert.equal(location.getURL(), '/admin/profile/');
}

['@test Existing state is preserved on init'](assert) {
Expand Down

0 comments on commit e8a6420

Please sign in to comment.