diff --git a/src/lib.rs b/src/lib.rs index d2bb644..7722524 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -519,7 +519,7 @@ struct UrlQuery { url: String, #[serde(default)] - backgrounded: bool, + backgrounded: Serde, } #[derive(Debug, serde::Deserialize)] @@ -560,7 +560,7 @@ async fn download( let stream = download_stream(&url_query.url, &state).await?; - if url_query.backgrounded { + if *url_query.backgrounded { do_download_backgrounded(stream, state, upload_query).await } else { do_download_inline(stream, &state, &upload_query).await diff --git a/src/queue/cleanup.rs b/src/queue/cleanup.rs index 659fbb2..b63fb6f 100644 --- a/src/queue/cleanup.rs +++ b/src/queue/cleanup.rs @@ -147,6 +147,15 @@ async fn hash(repo: &ArcRepo, hash: Hash) -> JobResult { pub(crate) async fn alias(repo: &ArcRepo, alias: Alias, token: DeleteToken) -> JobResult { let saved_delete_token = repo.delete_token(&alias).await.retry()?; + if saved_delete_token.is_none() { + let hash = repo.hash(&alias).await.retry()?; + + // already deleted + if hash.is_none() { + return Ok(()); + } + } + if !saved_delete_token.is_some_and(|t| t.ct_eq(&token)) { return Err(UploadError::InvalidToken).abort(); }