19
19
from shutil import copyfile
20
20
import requests
21
21
from PIL import Image
22
+ Image .MAX_IMAGE_PIXELS = 4096000000
22
23
from django .contrib .gis .gdal import GDALRaster
23
24
from django .contrib .gis .gdal import OGRGeometry
24
25
from django .contrib .gis .geos import GEOSGeometry
@@ -159,7 +160,7 @@ def resize_image(image_path, resize_to, done=None):
159
160
os .rename (resized_image_path , image_path )
160
161
161
162
logger .info ("Resized {} to {}x{}" .format (image_path , resized_width , resized_height ))
162
- except (IOError , ValueError , struct .error ) as e :
163
+ except (IOError , ValueError , struct .error , Image . DecompressionBombError ) as e :
163
164
logger .warning ("Cannot resize {}: {}." .format (image_path , str (e )))
164
165
if done is not None :
165
166
done ()
@@ -595,7 +596,7 @@ def handle_import(self):
595
596
596
597
fd .write (chunk )
597
598
598
- except (requests .exceptions .Timeout , requests .exceptions .ConnectionError , ReadTimeoutError ) as e :
599
+ except (requests .exceptions .Timeout , requests .exceptions .ConnectionError , ReadTimeoutError , requests . exceptions . MissingSchema ) as e :
599
600
raise NodeServerError (e )
600
601
601
602
self .refresh_from_db ()
@@ -604,7 +605,9 @@ def handle_import(self):
604
605
self .extract_assets_and_complete ()
605
606
except zipfile .BadZipFile :
606
607
raise NodeServerError (gettext ("Invalid zip file" ))
607
-
608
+ except NotImplementedError :
609
+ raise NodeServerError (gettext ("Unsupported compression method" ))
610
+
608
611
images_json = self .assets_path ("images.json" )
609
612
if os .path .exists (images_json ):
610
613
try :
0 commit comments