diff --git a/src/Cargo.lock b/src/Cargo.lock index d4c56e6..15499cd 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "orangutan-server" -version = "0.4.6" +version = "0.4.7" dependencies = [ "base64 0.22.1", "biscuit-auth", diff --git a/src/helpers/src/generate.rs b/src/helpers/src/generate.rs index 05a5c8b..70ce308 100644 --- a/src/helpers/src/generate.rs +++ b/src/helpers/src/generate.rs @@ -357,6 +357,12 @@ pub fn create_tmp_dir() -> Result<(), Error> { pub fn trash_outdated_websites() -> Result { trace!("Trashing outdated websites…"); + // Empty the trash (it's at least `HEAD~2` so we can safely delete it) + // NOTE: This whould not be necessary since the directory should be deleted + // but there might be edge cases where it's still there and the next + // `fs::rename` will fail if it's the case. + fs::remove_dir_all(TRASH_DIR.as_path())?; + // Remove outdated websites fs::rename(DEST_DIR.as_path(), TRASH_DIR.as_path())?; diff --git a/src/orangutan-server/Cargo.toml b/src/orangutan-server/Cargo.toml index 216985e..eeb5b9a 100644 --- a/src/orangutan-server/Cargo.toml +++ b/src/orangutan-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "orangutan-server" -version = "0.4.6" +version = "0.4.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html