fix: [items source] filter invalid item sources

pull/604/head
Terrtia 2023-08-29 14:03:26 +02:00
parent 099253f854
commit 7c73f0944a
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 6 additions and 2 deletions

View File

@ -204,7 +204,11 @@ def _get_dir_source_name(directory, source_name=None, l_sources_name=set(), filt
if not l_sources_name:
l_sources_name = set()
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:
l_dir = os.listdir(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
else:
for src_name in l_dir:
if len(src_name) == 4:
if len(src_name) == 4 and source_name:
# try:
int(src_name)
to_add = os.path.join(source_name)