From b1979ac36b9373c675a12b45a858da914ebf4d3a Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 22 Mar 2023 19:56:15 -0500 Subject: [PATCH 1/2] Proxito: allow serving files under the projects dir This is only available in the new implementation. Closes https://github.com/readthedocs/readthedocs.org/issues/2292 --- readthedocs/proxito/tests/test_full.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/readthedocs/proxito/tests/test_full.py b/readthedocs/proxito/tests/test_full.py index c892e5fcee8..09abaee31be 100644 --- a/readthedocs/proxito/tests/test_full.py +++ b/readthedocs/proxito/tests/test_full.py @@ -375,6 +375,16 @@ def setUp(self): future_default_true=True, ) + def test_single_version_serving_projects_dir(self): + self.project.single_version = True + self.project.save() + url = '/projects/awesome.html' + host = 'project.dev.readthedocs.io' + resp = self.client.get(url, HTTP_HOST=host) + self.assertEqual( + resp['x-accel-redirect'], '/proxito/media/html/project/latest/projects/awesome.html', + ) + @override_settings( PUBLIC_DOMAIN="dev.readthedocs.io", From 3e3188f46211fc2ac86d8a937eb373a8ed0816ad Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 23 Mar 2023 11:05:47 -0500 Subject: [PATCH 2/2] Black --- readthedocs/proxito/tests/test_full.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/readthedocs/proxito/tests/test_full.py b/readthedocs/proxito/tests/test_full.py index 09abaee31be..a5c33e107d0 100644 --- a/readthedocs/proxito/tests/test_full.py +++ b/readthedocs/proxito/tests/test_full.py @@ -378,11 +378,12 @@ def setUp(self): def test_single_version_serving_projects_dir(self): self.project.single_version = True self.project.save() - url = '/projects/awesome.html' - host = 'project.dev.readthedocs.io' + url = "/projects/awesome.html" + host = "project.dev.readthedocs.io" resp = self.client.get(url, HTTP_HOST=host) self.assertEqual( - resp['x-accel-redirect'], '/proxito/media/html/project/latest/projects/awesome.html', + resp["x-accel-redirect"], + "/proxito/media/html/project/latest/projects/awesome.html", )