Gracefully handle decodeURIComponent failure

This commit is contained in:
Josh Soref 2023-05-22 22:19:51 -04:00
parent 789f65c9ee
commit cc5f2fb439
3 changed files with 17 additions and 3 deletions

9
lib/fingerprints.js generated
View file

@ -194,7 +194,14 @@ function resolveUriToFile(location, artifacts, sourceRoot, logger) {
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
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
const fileUriPrefix = "file://";
if (uri.startsWith(fileUriPrefix)) {

File diff suppressed because one or more lines are too long