Gracefully handle decodeURIComponent failure
This commit is contained in:
parent
789f65c9ee
commit
cc5f2fb439
3 changed files with 17 additions and 3 deletions
9
lib/fingerprints.js
generated
9
lib/fingerprints.js
generated
|
|
@ -194,7 +194,14 @@ function resolveUriToFile(location, artifacts, sourceRoot, logger) {
|
||||||
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let uri = decodeURIComponent(location.uri);
|
let uri;
|
||||||
|
try {
|
||||||
|
uri = decodeURIComponent(location.uri);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
// Remove a file scheme, and abort if the scheme is anything else
|
// Remove a file scheme, and abort if the scheme is anything else
|
||||||
const fileUriPrefix = "file://";
|
const fileUriPrefix = "file://";
|
||||||
if (uri.startsWith(fileUriPrefix)) {
|
if (uri.startsWith(fileUriPrefix)) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -201,7 +201,14 @@ export function resolveUriToFile(
|
||||||
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let uri = decodeURIComponent(location.uri as string);
|
|
||||||
|
let uri: string;
|
||||||
|
try {
|
||||||
|
uri = decodeURIComponent(location.uri as string);
|
||||||
|
} catch (e: any) {
|
||||||
|
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove a file scheme, and abort if the scheme is anything else
|
// Remove a file scheme, and abort if the scheme is anything else
|
||||||
const fileUriPrefix = "file://";
|
const fileUriPrefix = "file://";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue