Skip to content

Commit 24b7d27

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 24cc344 commit 24b7d27

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
@@ -118,6 +118,10 @@ def canonicalize_url(url: str):
118118
for url in urls:
119119
value = urls.get(url)
120120

121+
# remove the URL anchor fragment
122+
url_parsed = urlparse(url)
123+
url = urlunparse(url_parsed._replace(fragment=""))
124+
121125
if url.startswith("https"):
122126
url_sanitized = canonicalize_url(url)
123127
else:

0 commit comments

Comments
 (0)