From 6773ae221da5321858fcfcb8d863be4bebddd39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 9 Dec 2016 14:34:40 +0100 Subject: [PATCH] Gracefully handle suddenly vanished files in storage listing --- src/octoprint/filemanager/storage.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index 2d595f54..f26a21ae 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -1123,11 +1123,16 @@ class LocalFileStorage(StorageInterface): # no hidden files and folders continue - entry_name = entry.name - entry_path = entry.path - entry_is_file = entry.is_file() - entry_is_dir = entry.is_dir() - entry_stat = entry.stat() + try: + entry_name = entry.name + entry_path = entry.path + entry_is_file = entry.is_file() + entry_is_dir = entry.is_dir() + entry_stat = entry.stat() + except: + # error while trying to fetch file metadata, that might be thanks to file already having + # been moved or deleted - ignore it and continue + continue try: new_entry_name, new_entry_path = self._sanitize_entry(entry_name, path, entry_path)