Skip to content

Commit a2475a7

Browse files
authored
Merge pull request #6558 from readthedocs/fix-proxito-redirect
Fix proxito redirects breaking without a /
2 parents 4b09c7a + 0bdfeb6 commit a2475a7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

readthedocs/proxito/views/serve.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,19 @@ def get(self, request, proxito_path, template_name='404.html'):
181181
filename=kwargs.get('filename', ''),
182182
)
183183

184+
# Always add a `/` to the filename to match our old logic:
185+
# https://github.com/readthedocs/readthedocs.org/blob/4b09c7a0ab45cd894c3373f7f07bad7161e4b223/readthedocs/redirects/utils.py#L60
186+
redirect_filename = filename
187+
if lang_slug and version_slug:
188+
redirect_filename = '/' + filename
189+
184190
# Check and perform redirects on 404 handler
185191
redirect_path, http_status = self.get_redirect(
186-
final_project,
187-
lang_slug,
188-
version_slug,
189-
filename,
190-
proxito_path,
192+
project=final_project,
193+
lang_slug=lang_slug,
194+
version_slug=version_slug,
195+
filename=redirect_filename,
196+
full_path=proxito_path,
191197
)
192198
if redirect_path and http_status:
193199
return self.get_redirect_response(request, redirect_path, http_status)

0 commit comments

Comments
 (0)