diff --git a/lib/galaxy/util/compression_utils.py b/lib/galaxy/util/compression_utils.py index b948951bea3..6a94c543196 100644 --- a/lib/galaxy/util/compression_utils.py +++ b/lib/galaxy/util/compression_utils.py @@ -29,5 +29,7 @@ def get_fileobj(filename, mode="r", gzip_only=False, bz2_only=False, zip_only=Fa if not gzip_only and not zip_only and is_bz2(filename): return bz2.BZ2File(filename, cmode) if not bz2_only and not gzip_only and zipfile.is_zipfile(filename): - return zipfile.os_zipfile(filename, cmode) + # Return fileobj for the first file in a zip file. + with zipfile.ZipFile(filename, cmode) as zh: + return zh.open(zh.namelist()[0], cmode) return open(filename, mode)