Skip to content

Commit 01e3f33

Browse files
committed
Dealing with or without subfolder in dwca
1 parent c169eaa commit 01e3f33

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

FrictionlessDarwinCore/archive.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
from FrictionlessDarwinCore import *
2+
from pathlib import Path
3+
24
import sys
35
import shutil
46
import requests
57
import zipfile
68
import tempfile
79

810

11+
912
class DwCArchive:
1013
voc = DwCVocabulary()
1114

@@ -46,10 +49,10 @@ def load(self):
4649
zf = zipfile.ZipFile(self.path, mode='r')
4750
try:
4851
for info in zf.infolist():
49-
fname=info.filename.rsplit("/",1)[1]
50-
if fname in ('eml.xml','metadata.xml'):
52+
p=Path(info.filename)
53+
if p.name in ('eml.xml','metadata.xml'):
5154
eml = zf.read(info.filename).decode()
52-
if fname == 'meta.xml':
55+
if p.name == 'meta.xml':
5356
meta = zf.read(info.filename).decode()
5457
if eml != '' and meta != '':
5558
self.metadata = DwCMetadata(eml)

0 commit comments

Comments
 (0)