Skip to content

Commit

Permalink
Gracefully handle decodeURIComponent failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed May 25, 2023
1 parent 789f65c commit cc5f2fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/fingerprints.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/fingerprints.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/fingerprints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,14 @@ export function resolveUriToFile(
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
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
const fileUriPrefix = "file://";
Expand Down

0 comments on commit cc5f2fb

Please sign in to comment.