fix: Check if sub-directories are actually directories and fail otherwise.

This will explicitly fail if a file (or an invalid symlink) is present.
Freqtrade requires these files to be valid files - so failing here is correct behavior.

closes #10720
This commit is contained in:
Matthias 2024-09-28 09:54:49 +02:00
parent 91d9c9b4d5
commit 3dc92b42fe

View File

@ -82,6 +82,11 @@ def create_userdata_dir(directory: str, create_dir: bool = False) -> Path:
for f in sub_dirs:
subfolder = folder / f
if not subfolder.is_dir():
if subfolder.exists(follow_symlinks=False):
raise OperationalException(
f"File `{subfolder}` exists already and is not a directory. "
"Freqtrade requires this to be a directory."
)
subfolder.mkdir(parents=False)
return folder