mirror of https://github.com/zulip/zulip.git
uploads: Move internal upload serving path to under /internal/.
This commit is contained in:
parent
b20ecabf8f
commit
24f95a3788
|
@ -1,4 +1,4 @@
|
||||||
location /serve_uploads {
|
location /internal/uploads {
|
||||||
internal;
|
internal;
|
||||||
include /etc/nginx/zulip-include/api_headers;
|
include /etc/nginx/zulip-include/api_headers;
|
||||||
add_header Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; object-src 'self'; plugin-types application/pdf;";
|
add_header Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; object-src 'self'; plugin-types application/pdf;";
|
||||||
|
|
|
@ -77,7 +77,7 @@ class zulip::app_frontend_base {
|
||||||
# pictures are served directly off disk.
|
# pictures are served directly off disk.
|
||||||
#
|
#
|
||||||
# For installations using S3 to serve uploaded files, we want Django
|
# For installations using S3 to serve uploaded files, we want Django
|
||||||
# to handle the /serve_uploads and /user_avatars routes, so that it
|
# to handle the /internal/uploads and /user_avatars routes, so that it
|
||||||
# can serve a redirect (after doing authentication, for uploads).
|
# can serve a redirect (after doing authentication, for uploads).
|
||||||
$no_serve_uploads = zulipconf('application_server', 'no_serve_uploads', false)
|
$no_serve_uploads = zulipconf('application_server', 'no_serve_uploads', false)
|
||||||
if $no_serve_uploads {
|
if $no_serve_uploads {
|
||||||
|
|
|
@ -948,7 +948,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
test_run, worker = os.path.split(os.path.dirname(settings.LOCAL_UPLOADS_DIR))
|
test_run, worker = os.path.split(os.path.dirname(settings.LOCAL_UPLOADS_DIR))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
response["X-Accel-Redirect"],
|
response["X-Accel-Redirect"],
|
||||||
"/serve_uploads/" + fp_path + "/" + name_str_for_test,
|
"/internal/uploads/" + fp_path + "/" + name_str_for_test,
|
||||||
)
|
)
|
||||||
if content_disposition != "":
|
if content_disposition != "":
|
||||||
self.assertIn("attachment;", response["Content-disposition"])
|
self.assertIn("attachment;", response["Content-disposition"])
|
||||||
|
|
|
@ -115,7 +115,7 @@ def serve_local(
|
||||||
patch_cache_control(response, private=True, immutable=True)
|
patch_cache_control(response, private=True, immutable=True)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
response = internal_nginx_redirect(quote(f"/serve_uploads/{path_id}"))
|
response = internal_nginx_redirect(quote(f"/internal/uploads/{path_id}"))
|
||||||
patch_disposition_header(response, local_path, attachment)
|
patch_disposition_header(response, local_path, attachment)
|
||||||
patch_cache_control(response, private=True, immutable=True)
|
patch_cache_control(response, private=True, immutable=True)
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue