fix: Copy files instead of move
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kieran 2024-05-01 22:02:00 +01:00
parent e9e6e26aa1
commit dad84168ea
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -54,10 +54,11 @@ impl FileStore {
let hash = FileStore::hash_file(&mut file).await?;
let dst_path = self.map_path(&hash);
fs::create_dir_all(dst_path.parent().unwrap())?;
if let Err(e) = fs::rename(&tmp_path, &dst_path) {
if let Err(e) = fs::copy(&tmp_path, &dst_path) {
fs::remove_file(&tmp_path)?;
Err(Error::from(e))
} else {
fs::remove_file(tmp_path)?;
Ok(FileSystemResult {
size: n,
sha256: hash,