mirror of
https://github.com/github/codeql-action.git
synced 2026-04-01 17:22:19 +00:00
Gracefully handle decodeURIComponent failure
This commit is contained in:
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`);
|
||||
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
@@ -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://";
|
||||
|
||||
Reference in New Issue
Block a user