Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

uploads: Improve file not found message.

arghyadeep101808cdec9006
diff --git a/zerver/tests/test_upload.py b/zerver/tests/test_upload.py
index fa2ea41aca5..29c51b8a7ed 100644
--- a/zerver/tests/test_upload.py
+++ b/zerver/tests/test_upload.py
@@ -359,7 +359,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
f"http://{hamlet.realm.host}/user_uploads/{hamlet.realm_id}/ff/gg/abc.py"
)
self.assertEqual(response.status_code, 404)
- self.assert_in_response("File not found.", response)
+ self.assert_in_response("This file does not exist or has been deleted.", response)
def test_delete_old_unclaimed_attachments(self) -> None:
# Upload some files and make them older than a week
diff --git a/zerver/views/upload.py b/zerver/views/upload.py
index 79fd1845c36..b39fec0d415 100644
--- a/zerver/views/upload.py
+++ b/zerver/views/upload.py
@@ -180,7 +180,7 @@ def serve_file(
is_authorized = validate_attachment_request(maybe_user_profile, path_id, realm)
if is_authorized is None:
- return HttpResponseNotFound(_("<p>File not found.</p>"))
+ return HttpResponseNotFound(_("<p>This file does not exist or has been deleted.</p>"))
if not is_authorized:
return HttpResponseForbidden(_("<p>You are not authorized to view this file.</p>"))
if url_only: