diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 0f53030b3d02..1598da174672 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -4297,9 +4297,9 @@ def __init__(self, **kwd): def sniff(self, filename: str) -> bool: try: - npz = np.load(filename) - if isinstance(npz, np.lib.npyio.NpzFile): - return True + with np.load(filename) as npz: + if isinstance(npz, np.lib.npyio.NpzFile) and any(f.filename.endswith(".npy") for f in npz.zip.filelist): + return True except Exception: return False return False