Skip to content

Commit

Permalink
Revert "fix: convert invalid uri regex"
Browse files Browse the repository at this point in the history
This reverts commit 0e935d1.

It fixed the crash of #70, but by always replacing special characters in
references by ":", so an external reference pointing to the "source
archive" "a%1.zip" would become "a:1.zip" while it should be
percent-encoded to "a%251.zip".
  • Loading branch information
gernot-h committed Jun 26, 2024
1 parent c8cac8b commit e3f6a70
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions capycli/common/capycli_bom_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
import pathlib
import uuid
import re
from datetime import datetime
from enum import Enum
from typing import Any, Dict, Iterable, List, Optional, Union
Expand Down Expand Up @@ -356,14 +355,9 @@ 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))
else:
cleaned_uri = str(value)
ext_ref = ExternalReference(
reference_type=type,
url=XsUri(cleaned_uri),
url=XsUri(value),
comment=comment)

if hash_algo and hash:
Expand Down

0 comments on commit e3f6a70

Please sign in to comment.