fix: the page waits while the antivirus restarts instead of showing its English reason (DTF-WEB-2F)
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 9m2s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m15s

At 19:22 a customer read "Malware scanner unavailable; file remains blocked":
the scan answered "error" (the antivirus not answering, likely restarting
with the deploy), and the page treated it as final, while the worker scans
an "error" file again a minute later (app/scanning.py). The page now keeps
waiting through "error", within the same budget as a pending scan; only
"rejected" stops at once, with its reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 16:40:38 -03:00
parent 1c32730ee7
commit 3b4f851fc2
2 changed files with 21 additions and 1 deletions

View File

@@ -81,7 +81,11 @@ async function sendUpload(file, {api, prefix='/uploads', startPath=prefix, progr
if(signal?.aborted)throw cancelled();
const checked=await api(prefix+'/'+id);
if(checked.scan_state==='clean')return id;
if(['rejected','error'].includes(checked.scan_state))throw new Error(checked.scan_reason||'Arquivo bloqueado pela verificação de segurança.');
if(checked.scan_state==='rejected')throw new Error(checked.scan_reason||'Arquivo bloqueado pela verificação de segurança.');
// "error" is the antivirus not answering (restarting with a deploy):
// the worker scans the file again a minute later (app/scanning.py), so
// the page keeps waiting instead of showing the scanner's English
// reason (Sentry DTF-WEB-2F).
progress('Verificando segurança de '+file.name+'…');
const pause=waited<150000?1000:5000;
await new Promise(resolve=>setTimeout(resolve,pause));