mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 03:11:24 +00:00
Fix backgrounded query boolean parsing
This commit is contained in:
parent
f05eed2e36
commit
dd01548309
2 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue