nixguix: Ensure to not use a redirection URL as an origin URL

Redirection URLs can be long and quite obscure in some cases (GitHub CDN
for instance) so ensure to use the redirected URL as origin URL.

Related to swh/meta#5090.
This commit is contained in:
Antoine Lambert 2024-04-24 14:25:39 +02:00
parent 41407e0eff
commit e51b808d72
2 changed files with 2 additions and 4 deletions

View file

@ -262,9 +262,7 @@ def is_tarball(
if location: # It's not always present
logger.debug("Location: %s", location)
try:
# FIXME: location is also returned as it's considered the true
# origin, true enough?
return _is_tarball(location), location
return _is_tarball(location), url
except ArtifactWithoutExtension:
logger.warning(
"Still cannot detect extension through location <%s>...",

View file

@ -189,7 +189,7 @@ def test_is_tarball_complex_with_location_result(
is_tar, origin = is_tarball(urls, requests)
assert is_tar == expected_result
if is_tar:
assert origin == fallback_url
assert origin == url
@pytest.mark.parametrize(