Skip to content

Commit

Permalink
fixed broken image would fail default importer
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Jun 26, 2023
1 parent 3955408 commit 6acd892
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cookbook/integration/default.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import traceback
from io import BytesIO, StringIO
from re import match
from zipfile import ZipFile
Expand All @@ -19,7 +20,10 @@ def get_recipe_from_file(self, file):
recipe = self.decode_recipe(recipe_string)
images = list(filter(lambda v: match('image.*', v), recipe_zip.namelist()))
if images:
self.import_recipe_image(recipe, BytesIO(recipe_zip.read(images[0])), filetype=get_filetype(images[0]))
try:
self.import_recipe_image(recipe, BytesIO(recipe_zip.read(images[0])), filetype=get_filetype(images[0]))
except AttributeError as e:
traceback.print_exc()
return recipe

def decode_recipe(self, string):
Expand Down

0 comments on commit 6acd892

Please sign in to comment.