File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/kili/services/asset_import Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 33import os
44from typing import List
55
6- from PIL import Image
6+ from PIL import Image , UnidentifiedImageError
77
88from kili .core .constants import mime_extensions_that_need_post_processing
99from kili .core .helpers import get_mime_type
@@ -79,9 +79,15 @@ def split_asset_by_upload_type(assets: List[AssetLike], is_hosted: bool):
7979 assert path
8080 assert isinstance (path , str )
8181 mime_type = get_mime_type (path )
82- is_large_image = ImageDataImporter .get_is_large_image (path )
83- if is_large_image or mime_type in mime_extensions_that_need_post_processing :
82+ if mime_type in mime_extensions_that_need_post_processing :
8483 async_assets .append (asset )
8584 else :
86- sync_assets .append (asset )
85+ try :
86+ is_large_image = ImageDataImporter .get_is_large_image (path )
87+ if is_large_image :
88+ async_assets .append (asset )
89+ else :
90+ sync_assets .append (asset )
91+ except UnidentifiedImageError :
92+ async_assets .append (asset )
8793 return sync_assets , async_assets
You can’t perform that action at this time.
0 commit comments