Clean alias before checking hash option

This commit is contained in:
asonix 2023-07-13 19:58:31 -05:00
parent afeac8294a
commit 4e58388b41

View file

@ -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() {