Skip to content

Commit 01ab6d6

Browse files
committed
fix: Remove any given anchor fragment in the URL canonicalization process
Some artifactories (e.g. JFrog), return URLs ending by an anchor, e.g. to carry the source artifact hash. To make the comparison work, remove those URL fragments. Signed-off-by: Nicolas Nobelis <nicolas.nobelis@bosch.com>
1 parent 56834e8 commit 01ab6d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/python_inspector/package_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ def canonicalize_url(url: str):
134134
for url in urls:
135135
value = urls.get(url)
136136

137+
# remove the URL anchor fragment
138+
url_parsed = urlparse(url)
139+
url = urlunparse(url_parsed._replace(fragment=""))
140+
137141
if url.startswith("https"):
138142
url_sanitized = canonicalize_url(url)
139143
else:

0 commit comments

Comments
 (0)