From f5cf7c521d182b0e23372bf6161a6cef3d6bf67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 11 Sep 2026 10:27:36 +0300 Subject: [PATCH] iz-web: multi-file upload reports the first failure, not the last file's luck --- crates/iz-web/src/files.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/iz-web/src/files.rs b/crates/iz-web/src/files.rs index f945627..7cb2ffb 100644 --- a/crates/iz-web/src/files.rs +++ b/crates/iz-web/src/files.rs @@ -402,12 +402,14 @@ async fn upload( Ok(backend) => backend, Err(_) => return Ok(back_to(&task_id, Some(Refusal::Unavailable))), }; + // Every file is attempted; the redirect answers the FIRST failure, not + // the last file's luck — an early loss must never read as success. let mut added: Result<(), Refusal> = Ok(()); for (file_name, bytes) in files { let label = label_of(&file_name); let mime_type = sniff(&bytes); - added = match backend { + let this = match backend { StorageBackend::Local => store .add_attachment(NewAttachment { task_id: &task_id, @@ -436,7 +438,7 @@ async fn upload( } }; - if added.is_ok() && comment_id.is_none() { + if this.is_ok() && comment_id.is_none() { let _ = store .record_activity( &task_id, @@ -448,6 +450,9 @@ async fn upload( ) .await; } + if added.is_ok() { + added = this; + } } Ok(match added {