From 6763ea61975e961f2f96bbadceabe1b15ef36ef8 Mon Sep 17 00:00:00 2001 From: Arksine Date: Fri, 13 Nov 2020 05:25:37 -0500 Subject: [PATCH] file_manager: correct issue with directories that contain spaces Signed-off-by: Eric Callahan --- moonraker/plugins/file_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moonraker/plugins/file_manager.py b/moonraker/plugins/file_manager.py index 31e951f..46556de 100644 --- a/moonraker/plugins/file_manager.py +++ b/moonraker/plugins/file_manager.py @@ -364,7 +364,8 @@ class FileManager: full_path = root_path dir_path = "" 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: filename = os.path.join(dir_path, filename) full_path = os.path.normpath(os.path.join(root_path, filename))