Skip to content

Commit

Permalink
Merge pull request #71 from sachinshaji/main
Browse files Browse the repository at this point in the history
fix: convert invalid uri regex
  • Loading branch information
tngraf authored Jun 20, 2024
2 parents 4b69568 + 0e935d1 commit c8cac8b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion capycli/common/capycli_bom_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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 @@ -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))
else:
cleaned_uri = str(value)
ext_ref = ExternalReference(
reference_type=type,
url=XsUri(value),
url=XsUri(cleaned_uri),
comment=comment)

if hash_algo and hash:
Expand Down

0 comments on commit c8cac8b

Please sign in to comment.