From 84d5ef12854868e23c99aa7964d2466f870ea06d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 9 Dec 2024 18:26:18 -0800 Subject: [PATCH] upload: Show text/plain uploads inline. Signed-off-by: Anders Kaseorg --- zerver/lib/upload/base.py | 1 + zerver/tests/test_upload.py | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/zerver/lib/upload/base.py b/zerver/lib/upload/base.py index c869c08ff4..05abde01bf 100644 --- a/zerver/lib/upload/base.py +++ b/zerver/lib/upload/base.py @@ -22,6 +22,7 @@ INLINE_MIME_TYPES = [ "image/jpeg", "image/png", "image/webp", + "text/plain", "video/mp4", "video/webm", # To avoid cross-site scripting attacks, DO NOT add types such diff --git a/zerver/tests/test_upload.py b/zerver/tests/test_upload.py index c1981ea875..f39dd0f8b1 100644 --- a/zerver/tests/test_upload.py +++ b/zerver/tests/test_upload.py @@ -1005,14 +1005,11 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase): self.assertIn(content_disposition, response["Content-disposition"]) self.assertEqual(set(response["Cache-Control"].split(", ")), {"private", "immutable"}) - check_xsend_links( - "zulip.txt", "zulip.txt", 'filename="zulip.txt"', returned_attachment=True - ) + check_xsend_links("zulip.txt", "zulip.txt", 'filename="zulip.txt"') check_xsend_links( "áéБД.txt", "%C3%A1%C3%A9%D0%91%D0%94.txt", "filename*=utf-8''%C3%A1%C3%A9%D0%91%D0%94.txt", - returned_attachment=True, ) check_xsend_links( "zulip.html",