Skip to content

Commit cc5f2fb

Browse files
committed
Gracefully handle decodeURIComponent failure
1 parent 789f65c commit cc5f2fb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

lib/fingerprints.js

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fingerprints.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/fingerprints.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,14 @@ export function resolveUriToFile(
201201
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
202202
return undefined;
203203
}
204-
let uri = decodeURIComponent(location.uri as string);
204+
205+
let uri: string;
206+
try {
207+
uri = decodeURIComponent(location.uri as string);
208+
} catch (e: any) {
209+
logger.debug(`Ignoring location as URI "${location.uri}" is invalid`);
210+
return undefined;
211+
}
205212

206213
// Remove a file scheme, and abort if the scheme is anything else
207214
const fileUriPrefix = "file://";

0 commit comments

Comments
 (0)