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

Fix backgrounded query boolean parsing

This commit is contained in:
asonix 2024-06-05 12:54:05 -05:00
parent f05eed2e36
commit dd01548309
2 changed files with 11 additions and 2 deletions

View file

@ -519,7 +519,7 @@ struct UrlQuery {
url: String,
#[serde(default)]
backgrounded: bool,
backgrounded: Serde<bool>,
}
#[derive(Debug, serde::Deserialize)]
@ -560,7 +560,7 @@ async fn download<S: Store + 'static>(
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

View file

@ -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();
}