Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/common/src/location/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,7 @@ export function createLocation() {
}

function _stripBasePath(basePath: string, url: string): string {
if (basePath === url) {
return '';
}
return basePath && url.startsWith(basePath + '/') ? url.substring(basePath.length) : url;
return basePath && url.startsWith(basePath) ? url.substring(basePath.length) : url;
}

function _stripIndexHtml(url: string): string {
Expand Down
14 changes: 0 additions & 14 deletions packages/common/test/location/location_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,4 @@ describe('Location Class', () => {
expect(location.normalize(url)).toBe(route);
});
});

describe('location.normalize(url) should return correct route', () => {
it('in case url starts with the substring equals APP_BASE_HREF', () => {
const baseHref = '/en';
const url = '/enigma';

TestBed.configureTestingModule({providers: [{provide: APP_BASE_HREF, useValue: baseHref}]});

const location = TestBed.inject(Location);

expect(location.normalize(url)).toBe(url);
expect(location.normalize(baseHref + url)).toBe(url);
});
});
});