deduplicate subjects before adding to statement (#180)
Signed-off-by: Brian DeHamer <bdehamer@github.com>
This commit is contained in:
+4
-1
@@ -71205,7 +71205,10 @@ const getSubjectFromPath = async (subjectPath, subjectName) => {
|
||||
for (const file of files) {
|
||||
const name = subjectName || path_1.default.parse(file).base;
|
||||
const digest = await digestFile(DIGEST_ALGORITHM, file);
|
||||
digestedSubjects.push({ name, digest: { [DIGEST_ALGORITHM]: digest } });
|
||||
// Only add the subject if it is not already in the list
|
||||
if (!digestedSubjects.some(s => s.name === name && s.digest[DIGEST_ALGORITHM] === digest)) {
|
||||
digestedSubjects.push({ name, digest: { [DIGEST_ALGORITHM]: digest } });
|
||||
}
|
||||
}
|
||||
if (digestedSubjects.length === 0) {
|
||||
throw new Error(`Could not find subject at path ${subjectPath}`);
|
||||
|
||||
Reference in New Issue
Block a user