If file hash doesn't match on adding a file, kill all metadata
This commit is contained in:
parent
1666a1f607
commit
ef01560199
1 changed files with 2 additions and 9 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue