Skip to content

Commit

Permalink
Fix routing path with double slash
Browse files Browse the repository at this point in the history
  • Loading branch information
Exelord committed Aug 2, 2019
1 parent a1b5a6b commit b70a442
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 b70a442

Please sign in to comment.