Julien Cristau pushed to branch master at snapshot / snapshot
Commits:
0bd1c098 by Baptiste Beauplat at 2022-09-13T21:07:47+02:00
Use 302 for redirect instead of 301
- - - - -
f58bf2e5 by Julien Cristau at 2022-09-13T19:17:58+00:00
Merge branch 'fix/redirect' into 'master'
Use 302 for redirect instead of 301
See merge request snapshot-team/snapshot!2
- - - - -
2 changed files:
- web/app/snapshot/views/archive.py
- web/app/tests/unit/views/test_archive.py
Changes:
=====================================
web/app/snapshot/views/archive.py
=====================================
@@ -93,7 +93,7 @@ def archive_dir(archive, date, path='/'):
except ArchiveError as e:
abort(404, str(e))
except ArchiveRedirect as e:
- return redirect(str(e), code=301)
+ return redirect(str(e))
if isinstance(node, ArchiveDir):
archive_dir.cache_timeout = current_app.config[
=====================================
web/app/tests/unit/views/test_archive.py
=====================================
@@ -128,10 +128,10 @@ def test_archive_runs(client, archive, year, month,
status, error, archive_view,
'/été'),
('20200813T185438Z', 404, 'No such file or directory', None,
'/dists///////not-found'),
- ('20200813T185438Z', 301, None, '20200813T185438Z/dists/unstable',
+ ('20200813T185438Z', 302, None, '20200813T185438Z/dists/unstable',
'/dists/sid'),
- ('40000813T185438Z', 301, None, '20200813T185438Z', ''),
- ('now', 301, None, '20200813T185438Z', ''),
+ ('40000813T185438Z', 302, None, '20200813T185438Z', ''),
+ ('now', 302, None, '20200813T185438Z', ''),
))
def test_archive_files(client, date, status, error, redirect, path,
archive_view, breadcrumbs):
@@ -141,7 +141,7 @@ def test_archive_files(client, date, status, error,
redirect, path,
if status == 404:
assert error in unescape(response.data.decode())
- elif status == 301:
+ elif status == 302:
assert response.location == \
f'http://localhost/archive/debian/{redirect}/'
else:
@@ -226,7 +226,7 @@ def test_archive_redirect_farm(client, config, date,
content, path):
response = client.get(f'/archive/debian/{date}{path}/')
- assert response.status_code == 301
+ assert response.status_code == 302
assert '/file/' in response.location
response = client.get(response.location)
View it on GitLab:
https://salsa.debian.org/snapshot-team/snapshot/-/compare/3e7f3fb8ae52f42a3600e7b4f3adbe89d7cbecd1...f58bf2e5f7fb722bbdaa9661521fe178fe1f3afa
--
View it on GitLab:
https://salsa.debian.org/snapshot-team/snapshot/-/compare/3e7f3fb8ae52f42a3600e7b4f3adbe89d7cbecd1...f58bf2e5f7fb722bbdaa9661521fe178fe1f3afa
You're receiving this email because of your account on salsa.debian.org.