mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-05 00:41:06 +03:00
Merge branch '430-UnboundLocalError-local-variable-im-referenced-before-assignment' into 'master'
fix handling unreadable images in update.extract_apk_icons Closes #430 See merge request fdroid/fdroidserver!416
This commit is contained in:
commit
873ff20a3c
1 changed files with 3 additions and 1 deletions
|
@ -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,7 +1492,8 @@ 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:
|
||||||
im.close()
|
if im:
|
||||||
|
im.close()
|
||||||
|
|
||||||
if apk['icons']:
|
if apk['icons']:
|
||||||
apk['icon'] = icon_filename
|
apk['icon'] = icon_filename
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue