diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index e0f80876..d195e067 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -95,6 +95,8 @@ impl StoreEntry { let file = try!(self.file.create_file()); assert_eq!(self.id, entry.location); + try!(file.set_len(0) + .map_err(|e| StoreError::new(StoreErrorKind::FileError, Some(Box::new(e))))); file.write_all(entry.to_str().as_bytes()) .map_err(|e| StoreError::new(StoreErrorKind::FileError, Some(Box::new(e)))) } else {