Skip to content

Commit 660d5b0

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 cde7c76 commit 660d5b0

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
@@ -124,6 +124,10 @@ def canonicalize_url(url: str):
124124
for url in urls:
125125
value = urls.get(url)
126126

127+
# remove the URL anchor fragment
128+
url_parsed = urlparse(url)
129+
url = urlunparse(url_parsed._replace(fragment=""))
130+
127131
if url.startswith("https"):
128132
url_sanitized = canonicalize_url(url)
129133
else:

0 commit comments

Comments
 (0)