From 776e0d6c90461c82bc3153aa81bec976491013b5 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 14 Sep 2021 14:43:00 -0400 Subject: [PATCH] file_manager: strip leading slashes supplied in the upload path argument Signed-off-by: Eric Callahan --- moonraker/components/file_manager/file_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moonraker/components/file_manager/file_manager.py b/moonraker/components/file_manager/file_manager.py index a6fbeff..52fbefa 100644 --- a/moonraker/components/file_manager/file_manager.py +++ b/moonraker/components/file_manager/file_manager.py @@ -443,7 +443,7 @@ class FileManager: if root not in self.file_paths: raise self.server.error(f"Root {root} not available") root_path = self.file_paths[root] - dir_path: str = upload_args.get('path', "") + dir_path: str = upload_args.get('path', "").lstrip("/") if os.path.isfile(root_path): filename: str = os.path.basename(root_path) dest_path = root_path