Skip to content

Commit 9b009e4

Browse files
add protocoll check
1 parent 4dce9ce commit 9b009e4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/common/urlUtils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ export function completeUrlEscapingRoot(base: string | undefined, relative: stri
200200

201201
export function isValidUrl(url: string): boolean {
202202
try {
203-
new URL(url);
204-
return true;
203+
const parsed = new URL(url);
204+
205+
return parsed.protocol.toLowerCase() == 'http:' || parsed.protocol.toLowerCase() == 'https:';
205206
} catch (e) {
206207
return false;
207208
}

src/targets/browser/browserPathResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class BrowserSourcePathResolver extends SourcePathResolverBase<IOptions>
205205
defaultPathMappingResolver,
206206
this.logger,
207207
);
208-
if (isValidUrl(computedSourceRoot) && isValidUrl(url)) {
208+
if (isValidUrl(computedSourceRoot)) {
209209
return new URL(url, computedSourceRoot).href;
210210
}
211211
return properResolve(computedSourceRoot, url);

0 commit comments

Comments
 (0)