mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Merge pull request #9595 from lecorguille/patch-2
Sniffer for multi-member zip archives
This commit is contained in:
@@ -843,6 +843,8 @@
|
||||
<sniffer type="galaxy.datatypes.binary:Cpt"/>
|
||||
<sniffer type="galaxy.datatypes.binary:Edr"/>
|
||||
<sniffer type="galaxy.datatypes.binary:Vel"/>
|
||||
<sniffer type="galaxy.datatypes.binary:Xlsx"/>
|
||||
<sniffer type="galaxy.datatypes.binary:CompressedZipArchive"/>
|
||||
<sniffer type="galaxy.datatypes.annotation:Augustus"/>
|
||||
<sniffer type="galaxy.datatypes.triples:Rdf"/>
|
||||
<sniffer type="galaxy.datatypes.blast:BlastXml"/>
|
||||
|
||||
@@ -249,6 +249,16 @@ class CompressedZipArchive(CompressedArchive):
|
||||
except Exception:
|
||||
return "Compressed zip file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def sniff(self, filename):
|
||||
with zipfile.ZipFile(filename) as zf:
|
||||
zf_files = zf.infolist()
|
||||
count = 0
|
||||
for f in zf_files:
|
||||
if f.file_size > 0 and not f.filename.startswith('__MACOSX/') and not f.filename.endswith('.DS_Store'):
|
||||
count += 1
|
||||
if count > 1:
|
||||
return True
|
||||
|
||||
|
||||
class GenericAsn1Binary(Binary):
|
||||
"""Class for generic ASN.1 binary format"""
|
||||
|
||||
Reference in New Issue
Block a user