Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
Zipped File protected with password as "infected" or not using javascript zip.min.js?

I have the code that checks whether the file is zipped with the password "infected or not"? It works fine when the file is a single or standalone executable/application that is zipped with password infected.

It doesn't work properly when there is a lot of files and zipped together with password "infected".

const verifyZip = async (file, password, id) => {
            let reader;
            try {
                reader = new zip.ZipReader(new zip.BlobReader(file), { password });
                const entries = await reader.getEntries();

                if (entries[0].encrypted) {
                    for (const entry of entries) {
                        try {
                            // await entry.getData(new zip.BlobWriter(),
                                await entry.getData(new zip.BlobWriter(),
                                {
                                    onprogress: (index, max)=>{
                                        zip.BlobWriter.$cancel()
                                        reader.close()
                                    }
                                });
                        } catch (error) {
                            if (error.message === zip.ERR_ENCRYPTED ||
                                error.message === zip.ERR_INVALID_PASSWORD) {
                                alert(file.name +" incorrect password, zip file will not be uploaded.")
                                // myFunction(file,id)
                                uploader.removeFile(id)
                                map.remove(id);
                                // $('#' + file.id).find('td.zip').text('zip file is invalid');
                                return false;
                            } else {
                                throw error;
                            }
                        }
                    }
                }else{
                    alert(file.name + " zip file does not have a password please enter the appropriate password and upload again.")
                    uploader.removeFile(id)
                    map.remove(id);
                    // myFunction(file,id)
                }} finally {
                // await reader.close();
                reader.close();
            }
            return true;
        };

        if (fileSuffix==="zip"){
             verifyZip(file.source.source, "infected",file.id)
        }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda