mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-20 13:50:12 +01:00
fix handling unreadable images in update.extract_apk_icons
This commit is contained in:
parent
82badb8921
commit
c17aeb5231
@ -1475,6 +1475,7 @@ def extract_apk_icons(icon_filename, apk, apkzip, repo_dir):
|
|||||||
icon_path = os.path.join(get_icon_dir(repo_dir, '0'), icon_filename)
|
icon_path = os.path.join(get_icon_dir(repo_dir, '0'), icon_filename)
|
||||||
with open(icon_path, 'wb') as f:
|
with open(icon_path, 'wb') as f:
|
||||||
f.write(get_icon_bytes(apkzip, icon_src))
|
f.write(get_icon_bytes(apkzip, icon_src))
|
||||||
|
im = None
|
||||||
try:
|
try:
|
||||||
im = Image.open(icon_path)
|
im = Image.open(icon_path)
|
||||||
dpi = px_to_dpi(im.size[0])
|
dpi = px_to_dpi(im.size[0])
|
||||||
@ -1491,6 +1492,7 @@ def extract_apk_icons(icon_filename, apk, apkzip, repo_dir):
|
|||||||
logging.warning(_("Failed reading {path}: {error}")
|
logging.warning(_("Failed reading {path}: {error}")
|
||||||
.format(path=icon_path, error=e))
|
.format(path=icon_path, error=e))
|
||||||
finally:
|
finally:
|
||||||
|
if im:
|
||||||
im.close()
|
im.close()
|
||||||
|
|
||||||
if apk['icons']:
|
if apk['icons']:
|
||||||
|
Loading…
Reference in New Issue
Block a user