Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions submit_app/processjar.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ def process_jar(jar_file, expect_app_name):
LOGGER.info('User uploaded invalid jar file: ' + str(bzf))
raise ValueError('is not a valid zip file')

manifest_file = archive.read(_MANIFEST_FILE_NAME)
manifest = parse_manifest(manifest_file)
archive.close()
# FIX: Context manager guarantees the ZipFile is closed
# and the file descriptor is released even if an exception occurs
with archive:
manifest_file = archive.read(_MANIFEST_FILE_NAME)
manifest = parse_manifest(manifest_file)

is_osgi_bundle = True if manifest.main_section[b'Bundle-SymbolicName'] else False
parser_func = _parse_osgi_bundle # if is_osgi_bundle else _parse_simple_app
Expand Down Expand Up @@ -190,4 +192,4 @@ def _parse_osgi_bundle(manifest):
has_export_pkg_str = None
has_export_pkg = True if has_export_pkg_str else False

return (app_name, app_version, app_works_with, app_dependencies, has_export_pkg)
return (app_name, app_version, app_works_with, app_dependencies, has_export_pkg)
Loading