Add purl2url support for rust - #17
Conversation
steven-esser
left a comment
There was a problem hiding this comment.
Can you add a few more tests here, especially cases where the rust url contains special characters or is Null?
|
Got this @MaJuRG |
|
Done @MaJuRG |
| scheme = url_parts.scheme | ||
| if not(scheme == 'pkg'): | ||
| raise Exception('Not a valid PURL') | ||
|
|
There was a problem hiding this comment.
Remove this empty space.
| """ | ||
| url_parts = urlparse(purl) | ||
| scheme = url_parts.scheme | ||
| if not(scheme == 'pkg'): |
There was a problem hiding this comment.
change this to if scheme != 'pkg':
|
Done @MaJuRG |
| url_parts = urlparse(purl) | ||
| scheme = url_parts.scheme | ||
| if scheme != 'pkg': | ||
| raise Exception('Not a valid PURL') |
There was a problem hiding this comment.
We should add a bit more detail here. We want to know why the given thing is not a valid pURL. What was missing from the string? The user would want to know this.
There was a problem hiding this comment.
Okay, cool got this one
|
|
||
| part_paths = part_paths[0].split('/') | ||
| if 'crates' != part_paths[0]: | ||
| raise Exception('Not a valid crate PURL') |
There was a problem hiding this comment.
Same thing as above. Why is the given pURL not a valid crate pURL?
|
Done @MaJuRG , BTW I think we should wait for package-url/packageurl-python#24 to get merged first, because we don't know which type it should be 'crates' or 'cargo', what say? |
|
@MaJuRG good to go ? |
| if scheme != 'pkg': | ||
| raise Exception('Not a valid PURL, `scheme` of URL should be `pkg` to be it a PURL for more info refer https://github.com/package-url/purl-spec/blob/master/README.rst') | ||
|
|
||
| else : |
There was a problem hiding this comment.
Do we really need this else here?
There was a problem hiding this comment.
Okay got this one 👌
Signed-off-by: TG1999 <tushar.goel.dav@gmail.com>
|
Done @MaJuRG |
steven-esser
left a comment
There was a problem hiding this comment.
@pombredanne Anything to add here?
Solves issue #13
Signed-off-by: TG1999 tushar.goel.dav@gmail.com