Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Rename MAX_ICON_FILE_SIZE.
Gaurav Pandey2ddc62e9b3d1
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex c6f404a6ff9..f58074c92cb 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -243,7 +243,7 @@ def fetch_initial_state_data(# Important: Encode units in the client-facing API name.state["max_avatar_file_size_mib"] = settings.MAX_AVATAR_FILE_SIZE_MIBstate["max_file_upload_size_mib"] = settings.MAX_FILE_UPLOAD_SIZE- state["max_icon_file_size_mib"] = settings.MAX_ICON_FILE_SIZE+ state["max_icon_file_size_mib"] = settings.MAX_ICON_FILE_SIZE_MIBstate["realm_upload_quota_mib"] = realm.upload_quota_bytes()state["realm_icon_url"] = realm_icon_url(realm)diff --git a/zerver/tests/test_upload.py b/zerver/tests/test_upload.pyindex 0fafff8e5ec..ad56feb0820 100644--- a/zerver/tests/test_upload.py+++ b/zerver/tests/test_upload.py@@ -1416,7 +1416,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):def test_realm_icon_upload_file_size_error(self) -> None:self.login("iago")with get_test_image_file(self.correct_files[0][0]) as fp:- with self.settings(MAX_ICON_FILE_SIZE=0):+ with self.settings(MAX_ICON_FILE_SIZE_MIB=0):result = self.client_post("/json/realm/icon", {"file": fp})self.assert_json_error(result, "Uploaded file is larger than the allowed limit of 0 MiB")diff --git a/zerver/views/realm_icon.py b/zerver/views/realm_icon.pyindex 171500ef0ee..55e889e0d19 100644--- a/zerver/views/realm_icon.py+++ b/zerver/views/realm_icon.py@@ -19,10 +19,10 @@ def upload_icon(request: HttpRequest, user_profile: UserProfile) -> HttpResponsereturn json_error(_("You must upload exactly one icon."))icon_file = list(request.FILES.values())[0]- if (settings.MAX_ICON_FILE_SIZE * 1024 * 1024) < icon_file.size:+ if (settings.MAX_ICON_FILE_SIZE_MIB * 1024 * 1024) < icon_file.size:return json_error(_("Uploaded file is larger than the allowed limit of {} MiB").format(- settings.MAX_ICON_FILE_SIZE,+ settings.MAX_ICON_FILE_SIZE_MIB,))upload_icon_image(icon_file, user_profile)diff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex 8856558eb3e..a0a0d2d8073 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -308,7 +308,7 @@ ZULIP_IOS_APP_ID = "org.zulip.Zulip"# Limits related to the size of file uploads; last few in MB.DATA_UPLOAD_MAX_MEMORY_SIZE = 25 * 1024 * 1024MAX_AVATAR_FILE_SIZE_MIB = 5-MAX_ICON_FILE_SIZE = 5+MAX_ICON_FILE_SIZE_MIB = 5MAX_LOGO_FILE_SIZE = 5MAX_EMOJI_FILE_SIZE = 5