Skip to content

Handle uppercase V prefix in semantic version comparison#3429

Closed
tjhub1983 wants to merge 1 commit intoanchore:mainfrom
tjhub1983:fix/uppercase-v-prefix
Closed

Handle uppercase V prefix in semantic version comparison#3429
tjhub1983 wants to merge 1 commit intoanchore:mainfrom
tjhub1983:fix/uppercase-v-prefix

Conversation

@tjhub1983
Copy link
Copy Markdown

Summary

Treat both v1.5.0 and V1.5.0 equivalently for version matching.

Fixes #3037

SBOM files with uppercase V prefix (e.g., V1500-SP2) were not being matched against CVE vulnerabilities because the version comparison logic only recognized lowercase v prefix.

Changes

  • Update regex from ^v\d+ to ^[vV]\d+ in semantic_version.go
  • Use direct slice [1:] instead of strings.TrimPrefix for consistency

Testing

Added test cases:

  • uppercase V prefix comparison: 1.5.0 vs V1.5.0
  • uppercase V prefix on this version: V1.5.0 vs 1.5.0

🤖 Generated with Claude Code

Treat both 'v1.5.0' and 'V1.5.0' equivalently for version matching.

Fixes issue anchore#3037 where SBOM files with uppercase V prefix
(e.g., 'V1500-SP2') were not matched against CVE vulnerabilities.

Changes:
- Update regex from ^v\d+ to ^[vV]\d+ to match both cases
- Use direct slice [1:] instead of strings.TrimPrefix for consistency

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kzantow
Copy link
Copy Markdown
Contributor

kzantow commented May 7, 2026

Thanks for the contribution! Looks like #3089 already covers this one. No worries at all — in the future, if you spot an existing PR for the same thing, adding a comment or 👍 there is a great way to help us prioritize it. Thanks again!

@kzantow kzantow closed this May 7, 2026
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.

Treat uppercase V prefixes the same as lowercase v prefixes in version comparison

2 participants