You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the PURL spec is evolving, other purl-dependant projects might fail to detect whether a given purl type is a valid type or just a random string that looks like a purl.
For instance, if we want to check from "test:ok/name@version", test is a supported type or not, we would have to check if it is one of purl.TypeBitbucket, purl.TypeCocoapods, purl.TypeCargo... etc., as the FromString func does not seem to validate the type,
As the PURL spec is evolving, other purl-dependant projects might fail to detect whether a given purl type is a valid type or just a random string that looks like a purl.
For instance, if we want to check from
"test:ok/name@version"
,test
is a supported type or not, we would have to check if it is one ofpurl.TypeBitbucket
,purl.TypeCocoapods
,purl.TypeCargo
... etc., as theFromString
func does not seem to validate the type,packageurl-go/packageurl.go
Lines 239 to 243 in 3587d8c
A simplistic approach I can think of is just having an exported
SupportedTypes
map[string]struct{}
like:This way, one could just do sth like:
if _, ok := purl.SupportedTypes[myTypeToCheck]; !ok { ...
to handle unsupported types.Do you think it makes sense? If so, I can raise a PR.
The text was updated successfully, but these errors were encountered: