mirror of
https://github.com/SinTan1729/recipe-box-for-wikijs.git
synced 2025-04-11 14:56:04 -05:00
fix: Error when directory does not exist
This commit is contained in:
parent
81269e74eb
commit
4e79d2163d
1 changed files with 5 additions and 1 deletions
|
@ -62,7 +62,11 @@ def valid_filename(directory, filename=None):
|
|||
directory = os.path.dirname(directory)
|
||||
|
||||
# Allow for directories.
|
||||
items = set(os.listdir(directory))
|
||||
try:
|
||||
items = os.listdir(directory)
|
||||
except:
|
||||
items = []
|
||||
|
||||
if filename in items:
|
||||
count = 1
|
||||
while test_filename(filename, count) in items:
|
||||
|
|
Loading…
Reference in a new issue