From 39372a947579d51f3f21cfb4d7b3fca928106408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 15 Aug 2016 14:15:13 +0200 Subject: [PATCH] Also sanitize leading . That way hidden files that are uploaded will be "de-hidden". Note that NO "de-hiding" of existing files will take place! --- src/octoprint/filemanager/storage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index b4578fff..0272dc16 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -624,7 +624,11 @@ class LocalFileStorage(StorageInterface): if "/" in name or "\\" in name: raise ValueError("name must not contain / or \\") - return self._slugify(name).replace(" ", "_") + result = self._slugify(name).replace(" ", "_") + if result.startswith("."): + # hidden files under *nix + result = result[1:] + return result def sanitize_path(self, path): """