Skip to content

Commit e0d62cb

Browse files
Revert "fix(common): Update Location to get a normalized URL valid in case a represented URL starts with the substring equals APP_BASE_HREF" (#48461)
This reverts commit ae0efb6. PR Close #48461
1 parent c864845 commit e0d62cb

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

packages/common/src/location/location.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,7 @@ export function createLocation() {
301301
}
302302

303303
function _stripBasePath(basePath: string, url: string): string {
304-
if (basePath === url) {
305-
return '';
306-
}
307-
return basePath && url.startsWith(basePath + '/') ? url.substring(basePath.length) : url;
304+
return basePath && url.startsWith(basePath) ? url.substring(basePath.length) : url;
308305
}
309306

310307
function _stripIndexHtml(url: string): string {

packages/common/test/location/location_spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,4 @@ describe('Location Class', () => {
266266
expect(location.normalize(url)).toBe(route);
267267
});
268268
});
269-
270-
describe('location.normalize(url) should return correct route', () => {
271-
it('in case url starts with the substring equals APP_BASE_HREF', () => {
272-
const baseHref = '/en';
273-
const url = '/enigma';
274-
275-
TestBed.configureTestingModule({providers: [{provide: APP_BASE_HREF, useValue: baseHref}]});
276-
277-
const location = TestBed.inject(Location);
278-
279-
expect(location.normalize(url)).toBe(url);
280-
expect(location.normalize(baseHref + url)).toBe(url);
281-
});
282-
});
283269
});

0 commit comments

Comments
 (0)