fix os error when deleting package and builds folder not available

This commit is contained in:
lukas-heiligenbrunner 2024-01-14 22:48:07 +01:00
parent a7bfad31c1
commit 1a09c1cdf9

View File

@ -45,7 +45,8 @@ pub async fn remove_pkg(db: &DatabaseConnection, pkg_id: i32) -> anyhow::Result<
.await?
.ok_or(anyhow!("id not found"))?;
fs::remove_dir_all(format!("./builds/{}", pkg.name))?;
// remove build dir if available
let _ = fs::remove_dir_all(format!("./builds/{}", pkg.name));
let versions = Versions::find()
.filter(versions::Column::PackageId.eq(pkg.id))