improved checksum parsing (#280)
Signed-off-by: Brian DeHamer <bdehamer@github.com>
This commit is contained in:
+6
-2
@@ -74225,8 +74225,12 @@ const getSubjectFromChecksumsString = (checksums) => {
|
||||
if (delimIndex === -1) {
|
||||
continue;
|
||||
}
|
||||
// Swallow the type identifier character at the beginning of the name
|
||||
const name = record.slice(delimIndex + 2);
|
||||
// It's common for checksum records to have a leading flag character before
|
||||
// the artifact name. It will be either a '*' or a space.
|
||||
const flag_and_name = record.slice(delimIndex + 1);
|
||||
const name = flag_and_name.startsWith('*') || flag_and_name.startsWith(' ')
|
||||
? flag_and_name.slice(1)
|
||||
: flag_and_name;
|
||||
const digest = record.slice(0, delimIndex);
|
||||
if (!HEX_STRING_RE.test(digest)) {
|
||||
throw new Error(`Invalid digest: ${digest}`);
|
||||
|
||||
Reference in New Issue
Block a user