Skip to content

Commit fdb9cb7

Browse files
wartabalxhub
authored andcommitted
fix(platform-browser): Get correct base path when using "." as base href when serving from the file:// protocol. (#53547)
Using http://a as the base URL returns / instead of the actual base path when using the file:// protocol. Using document.baseURI addresses this. Fixes #53546 PR Close #53547
1 parent f35adcb commit fdb9cb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/platform-browser/src/browser/browser_adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ function getBaseElementHref(): string|null {
9292
function relativePath(url: string): string {
9393
// The base URL doesn't really matter, we just need it so relative paths have something
9494
// to resolve against. In the browser `HTMLBaseElement.href` is always absolute.
95-
return new URL(url, 'http://a').pathname;
95+
return new URL(url, document.baseURI).pathname;
9696
}

0 commit comments

Comments
 (0)