Cleans the version, as univers was rejecting the version with ':'#2055
Cleans the version, as univers was rejecting the version with ':'#2055Arka-Saha wants to merge 1 commit intoaboutcode-org:mainfrom
Conversation
| try: | ||
| v_obj = GentooVersion(version) | ||
| except Exception: | ||
| v_obj = GentooVersion(clean_ver(version)) |
There was a problem hiding this comment.
We should avoid general exceptions
|
|
||
| def clean_ver(v): | ||
| # removes ":something" which univers rejects | ||
| return v.split(":", 1)[0] |
There was a problem hiding this comment.
Can you explain in more detail what the main error is there? If this is a univers bug, we can fix it in univers or we can ignore and log the invalid version if it truly is invalid.
I think we should not clean the version in VulnerableCode instead, we should use univers library to do this, or just log the invalid version and skip it.
There was a problem hiding this comment.
Hey there, yeah so according to me the versions having ':'were getting rejected, that's why I performed a cleaning sort of function. And yes I think we can use the fix in univers .
if you want then I can give it a try to fix the same in univers
There was a problem hiding this comment.
@Arka-Saha OK, let's just log the invalid version without cleaning it so the importer can run without any issues . Then create an issue in the univers library with all invalid versions and give it a try.
|
@Arka-Saha Gentle ping, could you update this PR or fix the DCO? I’d like to acknowledge your effort in trying to fix this issue, since we are migrating the Gentoo importer to advisory V2 |
univers was rejecting versions containing ":"
so, I added some code to clean it, 1. First tries the original version 2. if error, cleans the version 3. tries again until working.
I hope this result is upto the mark, but do let me know if there is any discrepancies. Looking forward for your reviews, and sorry for being this late, my apologies.
Thank You!