mirror of
https://github.com/SinTan1729/recipe-box-for-wikijs.git
synced 2025-04-19 01:50:01 -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)
|
directory = os.path.dirname(directory)
|
||||||
|
|
||||||
# Allow for directories.
|
# Allow for directories.
|
||||||
items = set(os.listdir(directory))
|
try:
|
||||||
|
items = os.listdir(directory)
|
||||||
|
except:
|
||||||
|
items = []
|
||||||
|
|
||||||
if filename in items:
|
if filename in items:
|
||||||
count = 1
|
count = 1
|
||||||
while test_filename(filename, count) in items:
|
while test_filename(filename, count) in items:
|
||||||
|
|
Loading…
Reference in a new issue