fix: a file the phone can no longer read says so in Portuguese and is picked again (DTF-WEB-2A)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m51s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 58s

Android Chrome threw NotReadableError reading a picked file (from Drive or
Photos, after switching apps); the customer saw the browser's English text
and "Tentar de novo", which reads the same dead file. The upload now says
"não conseguimos ler este arquivo no aparelho. Escolha o arquivo de novo",
the product page's button becomes "Escolher de novo" (the file leaves the
list and the picker opens), and the cart summary shows no retry for it.
upload_retry_test covers it and fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 18:05:46 -03:00
parent 961a72c0eb
commit cc0db89705
4 changed files with 55 additions and 9 deletions

View File

@@ -288,7 +288,7 @@
const p=enviar(file); p.catch(()=>{}); return p;
},
estado:file=>{const k=chaveArquivo(file),e=envios.get(k),f=falhas.get(k);
return f?{fase:'falhou',erro:f.error?.message||'erro no envio'}
return f?{fase:'falhou',erro:f.error?.message||'erro no envio',escolher:!!f.error?.unreadable}
:!e?null:e.done?{fase:'pronto'}:e.sent>=file.size?{fase:'verificando'}:{fase:'enviando',enviado:e.sent};},
deNovo:file=>{falhas.delete(chaveArquivo(file));enviar(file).catch(()=>{});pintaEnvio();},
// A file already on the server (a saved sheet opened for editing): its id
@@ -404,8 +404,12 @@
if (el) {
el.replaceChildren(document.createTextNode('Não foi possível enviar '+falhou[0].file.name+': '+
(falhou[0].error?.message||'erro no envio').replace(/\.$/,'')+(falhou.length>1?' (e mais '+(falhou.length-1)+')':'')+'. '));
const b=document.createElement('button'); b.type='button'; b.className='envioDeNovo'; b.textContent='Tentar de novo';
b.onclick=tentaDeNovo; el.append(b);
// A file the phone cannot read again is picked again on its product
// page; a retry here would read the same dead file (DTF-WEB-2A).
if (!falhou[0].error?.unreadable) {
const b=document.createElement('button'); b.type='button'; b.className='envioDeNovo'; b.textContent='Tentar de novo';
b.onclick=tentaDeNovo; el.append(b);
}
el.classList.remove('ok'); el.classList.add('erro');
}
if (topo) topo.textContent='· falha no envio';