2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

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