Skip to content

Include SpdxFiles with no name in the package verification code - #459

Open
arpitjain099 wants to merge 1 commit into
spdx:masterfrom
arpitjain099:fix/unnamed-file-verification-code
Open

arpitjain099 wants to merge 1 commit into
spdx:masterfrom
arpitjain099:fix/unnamed-file-verification-code

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

The SpdxFile[] overload of generatePackageVerificationCode adds a file's SHA1 only when getName() is present. That isPresent() keeps a null out of TreeSet.contains, but it also gates the add, so a file with no name is dropped from the digest rather than treated as not skipped. One unnamed file plus one excluded file currently hashes to the SHA1 of the empty string.

An absent name cannot match a skipped path, so only consult the set when there is a name. The new test covers the plain and the skipped case.

This touches the same two lines as #458. Please say which you would rather take first and I will rebase the other.

A file with no name cannot match any of the skipped file paths, so it should still contribute its SHA1 to the digest instead of being dropped.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

@goneall goneall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Thanks @arpitjain099

@goneall

goneall commented Nov 13, 2026

Copy link
Copy Markdown
Member

I just merged #458 - so please rebase and I can merge in this fix

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants