file_manager: correct issue with directories that contain spaces

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-11-13 05:25:37 -05:00
parent 697be6a822
commit 6763ea6197
1 changed files with 2 additions and 1 deletions

View File

@ -364,7 +364,8 @@ class FileManager:
full_path = root_path full_path = root_path
dir_path = "" dir_path = ""
else: else:
filename = "_".join(upload['filename'].strip().split()).lstrip("/") parts = os.path.split(upload['filename'].strip().lstrip("/"))
filename = os.path.join(parts[0], "_".join(parts[1].split()))
if dir_path: if dir_path:
filename = os.path.join(dir_path, filename) filename = os.path.join(dir_path, filename)
full_path = os.path.normpath(os.path.join(root_path, filename)) full_path = os.path.normpath(os.path.join(root_path, filename))