From 4e58388b41318fb2dc6fa9c2ae0dff74007f62a2 Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 13 Jul 2023 19:58:31 -0500 Subject: [PATCH] Clean alias before checking hash option --- src/queue/cleanup.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/queue/cleanup.rs b/src/queue/cleanup.rs index 8f1294c..3d6c162 100644 --- a/src/queue/cleanup.rs +++ b/src/queue/cleanup.rs @@ -132,13 +132,15 @@ where return Err(UploadError::InvalidToken.into()); } - let Some(hash) = repo.hash(&alias).await? else { + let hash = repo.hash(&alias).await?; + + AliasRepo::cleanup(repo, &alias).await?; + + let Some(hash) = hash else { // hash doesn't exist, nothing to do return Ok(()); }; - AliasRepo::cleanup(repo, &alias).await?; - repo.remove_alias(hash.clone(), &alias).await?; if repo.aliases(hash.clone()).await?.is_empty() {