forge
Explore
Log in

Don't you dare go Hollow

iz-web: multi-file upload reports the first failure, not the last file's luck

Browse files at this commit

f5cf7c521d182b0e23372bf6161a6cef3d6bf67aAhmet Kaan GümüşParent: a27a81d
crates/iz-web/src/files.rsmodified+7 -2
@@ -402,12 +402,14 @@ async fn upload(
402402 Ok(backend) => backend,
403403 Err(_) => return Ok(back_to(&task_id, Some(Refusal::Unavailable))),
404404 };
405+ // Every file is attempted; the redirect answers the FIRST failure, not
406+ // the last file's luck — an early loss must never read as success.
405407 let mut added: Result<(), Refusal> = Ok(());
406408 for (file_name, bytes) in files {
407409 let label = label_of(&file_name);
408410 let mime_type = sniff(&bytes);
409411
410- added = match backend {
412+ let this = match backend {
411413 StorageBackend::Local => store
412414 .add_attachment(NewAttachment {
413415 task_id: &task_id,
@@ -436,7 +438,7 @@ async fn upload(
436438 }
437439 };
438440
439- if added.is_ok() && comment_id.is_none() {
441+ if this.is_ok() && comment_id.is_none() {
440442 let _ = store
441443 .record_activity(
442444 &task_id,
@@ -448,6 +450,9 @@ async fn upload(
448450 )
449451 .await;
450452 }
453+ if added.is_ok() {
454+ added = this;
455+ }
451456 }
452457
453458 Ok(match added {