mirror of https://github.com/zulip/zulip.git
settings: Rename MAX_EMOJI_FILE_SIZE.
Rename MAX_EMOJI_FILE_SIZE to MAX_EMOJI_FILE_SIZE_MIB reflecting the size in mebibytes.
This commit is contained in:
parent
73059dd0c7
commit
f67fc37f7d
|
@ -32,8 +32,8 @@ handles emoji).
|
||||||
## Maximum file size
|
## Maximum file size
|
||||||
|
|
||||||
The maximum file size for uploads can be configured by the
|
The maximum file size for uploads can be configured by the
|
||||||
administrator of the Zulip server by setting `MAX_EMOJI_FILE_SIZE`
|
administrator of the Zulip server by setting `MAX_EMOJI_FILE_SIZE_MIB`
|
||||||
in the [server's settings][1]. `MAX_EMOJI_FILE_SIZE` defaults
|
in the [server's settings][1]. `MAX_EMOJI_FILE_SIZE_MIB` defaults
|
||||||
to 5MB.
|
to 5MB.
|
||||||
|
|
||||||
[1]: https://zulip.readthedocs.io/en/latest/subsystems/settings.html#server-settings
|
[1]: https://zulip.readthedocs.io/en/latest/subsystems/settings.html#server-settings
|
||||||
|
|
|
@ -207,7 +207,7 @@ class RealmEmojiTest(ZulipTestCase):
|
||||||
def test_emoji_upload_file_size_error(self) -> None:
|
def test_emoji_upload_file_size_error(self) -> None:
|
||||||
self.login("iago")
|
self.login("iago")
|
||||||
with get_test_image_file("img.png") as fp:
|
with get_test_image_file("img.png") as fp:
|
||||||
with self.settings(MAX_EMOJI_FILE_SIZE=0):
|
with self.settings(MAX_EMOJI_FILE_SIZE_MIB=0):
|
||||||
result = self.client_post("/json/realm/emoji/my_emoji", {"file": fp})
|
result = self.client_post("/json/realm/emoji/my_emoji", {"file": fp})
|
||||||
self.assert_json_error(result, "Uploaded file is larger than the allowed limit of 0 MiB")
|
self.assert_json_error(result, "Uploaded file is larger than the allowed limit of 0 MiB")
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ def upload_emoji(
|
||||||
if len(request.FILES) != 1:
|
if len(request.FILES) != 1:
|
||||||
return json_error(_("You must upload exactly one file."))
|
return json_error(_("You must upload exactly one file."))
|
||||||
emoji_file = list(request.FILES.values())[0]
|
emoji_file = list(request.FILES.values())[0]
|
||||||
if (settings.MAX_EMOJI_FILE_SIZE * 1024 * 1024) < emoji_file.size:
|
if (settings.MAX_EMOJI_FILE_SIZE_MIB * 1024 * 1024) < emoji_file.size:
|
||||||
return json_error(
|
return json_error(
|
||||||
_("Uploaded file is larger than the allowed limit of {} MiB").format(
|
_("Uploaded file is larger than the allowed limit of {} MiB").format(
|
||||||
settings.MAX_EMOJI_FILE_SIZE,
|
settings.MAX_EMOJI_FILE_SIZE_MIB,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ LOGGING_SHOW_PID = False
|
||||||
SENTRY_DSN: Optional[str] = None
|
SENTRY_DSN: Optional[str] = None
|
||||||
|
|
||||||
# File uploads and avatars
|
# File uploads and avatars
|
||||||
|
# TODO: Rename MAX_FILE_UPLOAD_SIZE to have unit in name.
|
||||||
DEFAULT_AVATAR_URI = "/static/images/default-avatar.png"
|
DEFAULT_AVATAR_URI = "/static/images/default-avatar.png"
|
||||||
DEFAULT_LOGO_URI = "/static/images/logo/zulip-org-logo.svg"
|
DEFAULT_LOGO_URI = "/static/images/logo/zulip-org-logo.svg"
|
||||||
S3_AVATAR_BUCKET = ""
|
S3_AVATAR_BUCKET = ""
|
||||||
|
@ -310,7 +311,7 @@ DATA_UPLOAD_MAX_MEMORY_SIZE = 25 * 1024 * 1024
|
||||||
MAX_AVATAR_FILE_SIZE_MIB = 5
|
MAX_AVATAR_FILE_SIZE_MIB = 5
|
||||||
MAX_ICON_FILE_SIZE_MIB = 5
|
MAX_ICON_FILE_SIZE_MIB = 5
|
||||||
MAX_LOGO_FILE_SIZE_MIB = 5
|
MAX_LOGO_FILE_SIZE_MIB = 5
|
||||||
MAX_EMOJI_FILE_SIZE = 5
|
MAX_EMOJI_FILE_SIZE_MIB = 5
|
||||||
|
|
||||||
# Limits to help prevent spam, in particular by sending invitations.
|
# Limits to help prevent spam, in particular by sending invitations.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue