From ef0156019955e1a6d6159c39f0cbc22f9333b181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 10 Apr 2017 17:31:00 +0200 Subject: [PATCH] If file hash doesn't match on adding a file, kill all metadata --- src/octoprint/filemanager/storage.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index bbc90b09..c69b3e14 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -669,16 +669,9 @@ class LocalFileStorage(StorageInterface): # save the file's hash to the metadata of the folder file_hash = self._create_hash(file_path) metadata = self._get_metadata_entry(path, name, default=dict()) - metadata_dirty = False if not "hash" in metadata or metadata["hash"] != file_hash: - metadata["hash"] = file_hash - metadata_dirty = True - if "analysis" in metadata: - del metadata["analysis"] - metadata_dirty = True - - if metadata_dirty: - self._update_metadata_entry(path, name, metadata) + # hash changed -> throw away old metadata + self._update_metadata_entry(path, name, dict(hash=file_hash)) # process any links that were also provided for adding to the file if not links: