mirror of https://github.com/zulip/zulip.git
ruff: Fix SIM300 Yoda conditions are discouraged.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
3dfc24a908
commit
ab25ebd5ce
|
@ -44,7 +44,7 @@ def upload_emoji(
|
|||
[emoji_file] = request.FILES.values()
|
||||
assert isinstance(emoji_file, UploadedFile)
|
||||
assert emoji_file.size is not None
|
||||
if (settings.MAX_EMOJI_FILE_SIZE_MIB * 1024 * 1024) < emoji_file.size:
|
||||
if emoji_file.size > settings.MAX_EMOJI_FILE_SIZE_MIB * 1024 * 1024:
|
||||
raise JsonableError(
|
||||
_("Uploaded file is larger than the allowed limit of {max_size} MiB").format(
|
||||
max_size=settings.MAX_EMOJI_FILE_SIZE_MIB,
|
||||
|
|
|
@ -22,7 +22,7 @@ def upload_icon(request: HttpRequest, user_profile: UserProfile) -> HttpResponse
|
|||
[icon_file] = request.FILES.values()
|
||||
assert isinstance(icon_file, UploadedFile)
|
||||
assert icon_file.size is not None
|
||||
if (settings.MAX_ICON_FILE_SIZE_MIB * 1024 * 1024) < icon_file.size:
|
||||
if icon_file.size > settings.MAX_ICON_FILE_SIZE_MIB * 1024 * 1024:
|
||||
raise JsonableError(
|
||||
_("Uploaded file is larger than the allowed limit of {max_size} MiB").format(
|
||||
max_size=settings.MAX_ICON_FILE_SIZE_MIB,
|
||||
|
|
|
@ -28,7 +28,7 @@ def upload_logo(
|
|||
[logo_file] = request.FILES.values()
|
||||
assert isinstance(logo_file, UploadedFile)
|
||||
assert logo_file.size is not None
|
||||
if (settings.MAX_LOGO_FILE_SIZE_MIB * 1024 * 1024) < logo_file.size:
|
||||
if logo_file.size > settings.MAX_LOGO_FILE_SIZE_MIB * 1024 * 1024:
|
||||
raise JsonableError(
|
||||
_("Uploaded file is larger than the allowed limit of {max_size} MiB").format(
|
||||
max_size=settings.MAX_LOGO_FILE_SIZE_MIB,
|
||||
|
|
|
@ -315,7 +315,7 @@ def upload_file_backend(request: HttpRequest, user_profile: UserProfile) -> Http
|
|||
assert isinstance(user_file, UploadedFile)
|
||||
file_size = user_file.size
|
||||
assert file_size is not None
|
||||
if settings.MAX_FILE_UPLOAD_SIZE * 1024 * 1024 < file_size:
|
||||
if file_size > settings.MAX_FILE_UPLOAD_SIZE * 1024 * 1024:
|
||||
raise JsonableError(
|
||||
_("Uploaded file is larger than the allowed limit of {max_size} MiB").format(
|
||||
max_size=settings.MAX_FILE_UPLOAD_SIZE,
|
||||
|
|
|
@ -410,7 +410,7 @@ def set_avatar_backend(request: HttpRequest, user_profile: UserProfile) -> HttpR
|
|||
[user_file] = request.FILES.values()
|
||||
assert isinstance(user_file, UploadedFile)
|
||||
assert user_file.size is not None
|
||||
if (settings.MAX_AVATAR_FILE_SIZE_MIB * 1024 * 1024) < user_file.size:
|
||||
if user_file.size > settings.MAX_AVATAR_FILE_SIZE_MIB * 1024 * 1024:
|
||||
raise JsonableError(
|
||||
_("Uploaded file is larger than the allowed limit of {max_size} MiB").format(
|
||||
max_size=settings.MAX_AVATAR_FILE_SIZE_MIB,
|
||||
|
|
Loading…
Reference in New Issue