mirror of https://github.com/CIRCL/AIL-framework
fix: [items source] filter invalid item sources
parent
099253f854
commit
7c73f0944a
|
@ -204,7 +204,11 @@ def _get_dir_source_name(directory, source_name=None, l_sources_name=set(), filt
|
||||||
if not l_sources_name:
|
if not l_sources_name:
|
||||||
l_sources_name = set()
|
l_sources_name = set()
|
||||||
if source_name:
|
if source_name:
|
||||||
l_dir = os.listdir(os.path.join(directory, source_name))
|
path = os.path.join(directory, source_name)
|
||||||
|
if os.path.isdir(path):
|
||||||
|
l_dir = os.listdir(os.path.join(directory, source_name))
|
||||||
|
else:
|
||||||
|
l_dir = []
|
||||||
else:
|
else:
|
||||||
l_dir = os.listdir(directory)
|
l_dir = os.listdir(directory)
|
||||||
# empty directory
|
# empty directory
|
||||||
|
@ -215,7 +219,7 @@ def _get_dir_source_name(directory, source_name=None, l_sources_name=set(), filt
|
||||||
return l_sources_name
|
return l_sources_name
|
||||||
else:
|
else:
|
||||||
for src_name in l_dir:
|
for src_name in l_dir:
|
||||||
if len(src_name) == 4:
|
if len(src_name) == 4 and source_name:
|
||||||
# try:
|
# try:
|
||||||
int(src_name)
|
int(src_name)
|
||||||
to_add = os.path.join(source_name)
|
to_add = os.path.join(source_name)
|
||||||
|
|
Loading…
Reference in New Issue