ensure subject globs match only files (#54)

Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
Brian DeHamer
2024-05-06 11:52:03 -07:00
committed by GitHub
parent c58d52c41d
commit d442d85e12
3 changed files with 22 additions and 0 deletions
Generated Vendored
+4
View File
@@ -79897,6 +79897,10 @@ const getSubjectFromPath = async (subjectPath, subjectName) => {
/* eslint-disable-next-line github/no-then */
const files = await glob.create(subPath).then(async (g) => g.glob());
for (const file of files) {
// Skip anything that is NOT a file
if (!fs_1.default.statSync(file).isFile()) {
continue;
}
const name = subjectName || path_1.default.parse(file).base;
const digest = await digestFile(DIGEST_ALGORITHM, file);
subjects.push({ name, digest: { [DIGEST_ALGORITHM]: digest } });