File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2929 <key >UIMainStoryboardFile </key >
3030 <string >Main </string >
3131 <key >UISupportedInterfaceOrientations </key >
32+ <key >NSAppTransportSecurity </key >
33+ <dict >
34+ <key >NSAllowsLocalNetworking </key >
35+ <true />
36+ </dict >
3237 <array >
3338 <string >UIInterfaceOrientationPortrait </string >
3439 <string >UIInterfaceOrientationLandscapeLeft </string >
Original file line number Diff line number Diff line change @@ -102,7 +102,14 @@ async def execute(
102102 logger .info (f" Extracting { len (part .root .file .bytes )} bytes" )
103103 try :
104104 image_bytes = base64 .b64decode (file_data .bytes )
105- filename = f"{ uuid .uuid4 ()} .jpg" # Default to jpg, or try to detect
105+ mime_type = file_data .mime_type
106+ extension = {
107+ "image/png" : ".png" ,
108+ "image/jpeg" : ".jpg" ,
109+ "image/heic" : ".heic" ,
110+ "image/webp" : ".webp" ,
111+ }.get (mime_type , ".jpg" )
112+ filename = f"{ uuid .uuid4 ()} { extension } "
106113 images_dir = os .path .join (os .path .dirname (__file__ ), "images" , "uploads" )
107114 os .makedirs (images_dir , exist_ok = True )
108115 filepath = os .path .join (images_dir , filename )
You can’t perform that action at this time.
0 commit comments