Skip to content

Replace inline PURL construction with purl library#15

Merged
andrew merged 1 commit intomainfrom
use-purl-library
Mar 4, 2026
Merged

Replace inline PURL construction with purl library#15
andrew merged 1 commit intomainfrom
use-purl-library

Conversation

@andrew
Copy link
Contributor

@andrew andrew commented Mar 4, 2026

Replaces all fmt.Sprintf("pkg:%s/%s", ...) PURL construction with purl.MakePURLString() which correctly handles namespace splitting (npm scopes like @babel/core, Go module paths, Maven group IDs, Composer vendors) and percent-encoding.

Also removes the hand-rolled extractEcosystem, startsWith, and indexOf helpers from handler.go in favor of purl.Parse(), and replaces inline PURL parsing in the bulk lookup API fallback path.

Uses purl.MakePURLString() instead of fmt.Sprintf("pkg:...") for
correct namespace handling (npm scopes, Go module paths, Maven group
IDs) and percent-encoding. Replaces hand-rolled extractEcosystem and
inline PURL parsing in the bulk lookup fallback with purl.Parse().
@andrew andrew merged commit 5f4c576 into main Mar 4, 2026
4 checks passed
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.

1 participant