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

@@ -117,7 +117,7 @@ function pintaErrosDosArquivos(){
texto.textContent='Não foi possível enviar '+item.f.name+': '+
(estado.erro||'erro no envio').replace(/\.$/,'')+'.';
const button=document.createElement('button');
button.type='button';button.textContent='Tentar de novo';
button.type='button';button.textContent=estado.escolher?'Escolher de novo':'Tentar de novo';
button.dataset.envioCard=kind;button.dataset.envioIndex=String(index);
box.append(texto,button);card.append(box);
});
@@ -140,7 +140,8 @@ function pintaEnvios(){
return agora-enviadoEm.get(f)>ENVIADO_MS ? '' : '<div class="envio ok">'+icone('okCirculo')+'<span>'+nome+' enviado</span></div>';
}
if(e.fase==='falhou') return '<div class="envio erro"><span>Não foi possível enviar '+nome+': '+
escapeHTML(e.erro.replace(/\.$/,''))+'.</span><button type="button" data-envio="'+i+'">Tentar de novo</button></div>';
escapeHTML(e.erro.replace(/\.$/,''))+'.</span><button type="button" data-envio="'+i+'">'+
(e.escolher?'Escolher de novo':'Tentar de novo')+'</button></div>';
const pct=e.fase==='verificando' ? 100 : Math.floor(e.enviado/f.size*100);
return '<div class="envio"><span>'+(e.fase==='verificando' ? 'Verificando a segurança de '+nome+'…'
: 'Enviando '+nome+' · '+pct+'% · '+fmt(e.enviado)+' de '+fmt(f.size))+'</span>'+
@@ -148,14 +149,25 @@ function pintaEnvios(){
}).join('');
}
addEventListener('dtf-envio',agendaEnvios);
// A failed upload goes again; one the phone can no longer read (Android,
// DTF-WEB-2A) would fail the same way, so its file leaves the list and the
// picker opens for the customer to choose it again.
function refazEnvio(x, lista){
if(!x) return;
if(!dtfEnvio.estado(x.f)?.escolher){ dtfEnvio.deNovo(x.f); return; }
const i=lista.indexOf(x);
if(i>=0){ lista.splice(i,1); lista===folhas?pintaFolha():pintaArtes(); }
$('inp').click();
}
$('envios').addEventListener('click',e=>{
const b=e.target.closest('[data-envio]'); if(!b || !MODOS[modo]) return;
const x=(ehFolha()?folhas:artes)[+b.dataset.envio]; if(x) dtfEnvio.deNovo(x.f);
const lista=ehFolha()?folhas:artes;
refazEnvio(lista[+b.dataset.envio], lista);
});
$('lista').addEventListener('click',e=>{
const b=e.target.closest('[data-envio-card]'); if(!b || !window.dtfEnvio) return;
const x=(b.dataset.envioCard==='folha'?folhas:artes)[+b.dataset.envioIndex];
if(x) dtfEnvio.deNovo(x.f);
const lista=b.dataset.envioCard==='folha'?folhas:artes;
refazEnvio(lista[+b.dataset.envioIndex], lista);
});
// A sheet with residue gets its preview circled where the dots are.
async function marcaResiduos(x){