Only use altered filename in the redirects code
@@ -183,15 +183,16 @@ class ServeError404Base(ServeRedirectMixin, View):
# Always add a `/` to the filename to match our old logic:
# https://github.com/readthedocs/readthedocs.org/blob/4b09c7a0ab45cd894c3373f7f07bad7161e4b223/readthedocs/redirects/utils.py#L60
+ redirect_file = filename
if lang_slug and version_slug:
- filename = '/' + filename
+ redirect_filename = '/' + filename
# Check and perform redirects on 404 handler
redirect_path, http_status = self.get_redirect(
project=final_project,
lang_slug=lang_slug,
version_slug=version_slug,
- filename=filename,
+ filename=redirect_filename,
full_path=proxito_path,
)
if redirect_path and http_status:
