mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	settings: Rename MAX_LOGO_FILE_SIZE.
Rename MAX_LOGO_FILE_SIZE to MAX_LOGO_FILE_SIZE_MIB reflecting the size in mebibytes.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							2ddc62e9b3
						
					
				
				
					commit
					73059dd0c7
				
			@@ -81,7 +81,7 @@ def add_realm_logo_fields(state: Dict[str, Any], realm: Realm) -> None:
 | 
			
		||||
    state["realm_logo_source"] = get_realm_logo_source(realm, night=False)
 | 
			
		||||
    state["realm_night_logo_url"] = get_realm_logo_url(realm, night=True)
 | 
			
		||||
    state["realm_night_logo_source"] = get_realm_logo_source(realm, night=True)
 | 
			
		||||
    state["max_logo_file_size_mib"] = settings.MAX_LOGO_FILE_SIZE
 | 
			
		||||
    state["max_logo_file_size_mib"] = settings.MAX_LOGO_FILE_SIZE_MIB
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def always_want(msg_type: str) -> bool:
 | 
			
		||||
 
 | 
			
		||||
@@ -1601,7 +1601,7 @@ class RealmLogoTest(UploadSerializeMixin, ZulipTestCase):
 | 
			
		||||
    def test_logo_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_LOGO_FILE_SIZE=0):
 | 
			
		||||
            with self.settings(MAX_LOGO_FILE_SIZE_MIB=0):
 | 
			
		||||
                result = self.client_post(
 | 
			
		||||
                    "/json/realm/logo", {"file": fp, "night": orjson.dumps(self.night).decode()}
 | 
			
		||||
                )
 | 
			
		||||
 
 | 
			
		||||
@@ -24,10 +24,10 @@ def upload_logo(
 | 
			
		||||
    if len(request.FILES) != 1:
 | 
			
		||||
        return json_error(_("You must upload exactly one logo."))
 | 
			
		||||
    logo_file = list(request.FILES.values())[0]
 | 
			
		||||
    if (settings.MAX_LOGO_FILE_SIZE * 1024 * 1024) < logo_file.size:
 | 
			
		||||
    if (settings.MAX_LOGO_FILE_SIZE_MIB * 1024 * 1024) < logo_file.size:
 | 
			
		||||
        return json_error(
 | 
			
		||||
            _("Uploaded file is larger than the allowed limit of {} MiB").format(
 | 
			
		||||
                settings.MAX_LOGO_FILE_SIZE,
 | 
			
		||||
                settings.MAX_LOGO_FILE_SIZE_MIB,
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
    upload_logo_image(logo_file, user_profile, night)
 | 
			
		||||
 
 | 
			
		||||
@@ -309,7 +309,7 @@ ZULIP_IOS_APP_ID = "org.zulip.Zulip"
 | 
			
		||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 25 * 1024 * 1024
 | 
			
		||||
MAX_AVATAR_FILE_SIZE_MIB = 5
 | 
			
		||||
MAX_ICON_FILE_SIZE_MIB = 5
 | 
			
		||||
MAX_LOGO_FILE_SIZE = 5
 | 
			
		||||
MAX_LOGO_FILE_SIZE_MIB = 5
 | 
			
		||||
MAX_EMOJI_FILE_SIZE = 5
 | 
			
		||||
 | 
			
		||||
# Limits to help prevent spam, in particular by sending invitations.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user