Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert invalid uri regex #71

Merged
merged 1 commit into from
Jun 20, 2024
Merged

fix: convert invalid uri regex #71

merged 1 commit into from
Jun 20, 2024

Conversation

sachinshaji
Copy link

@sachinshaji sachinshaji commented Jun 19, 2024

This PR is to address this issue.
@gernot-h Please have a look.

@tngraf tngraf merged commit c8cac8b into sw360:main Jun 20, 2024
5 checks passed
@tngraf
Copy link
Collaborator

tngraf commented Jun 20, 2024

@sachinshaji Thanks a lot for fixing.

@gernot-h
Copy link
Collaborator

@sachinshaji, sorry for the late answer here!

I finally had a chance to have a look on #70 and your fix here and I'm a bit confused. Perhaps you can explain this a bit better?

@@ -355,9 +356,14 @@ def get_ext_ref(comp: Component, type: ExternalReferenceType, comment: str) -> O
@staticmethod
def set_ext_ref(comp: Component, type: ExternalReferenceType, comment: str, value: str,
hash_algo: str = "", hash: str = "") -> None:

if re.search(XsUri._INVALID_URI_REGEX, str(value)):
cleaned_uri = re.sub(XsUri._INVALID_URI_REGEX, ':', str(value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I get this right, XsUri._INVALID_URI_REGEX mainly checks for invalid percent encoding in a URL, so I'm not sure how this would apply to #70. Also, I'm a bit confused why you replace invalid URL parts with a ":" here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gernot-h Try to take a look at the original CycloneDX code of XsUri. They do this check and then throw an exception.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, and I don't yet see how replacing invalid percent encoding by ":" can help here, but I will try to reproduce #70 as you suggested and then debug it on myself. :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated fix available in #72.

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.

3 participants