diff --git a/src/js/operations/Compress.js b/src/js/operations/Compress.js index d9f6b32c..124f49ad 100755 --- a/src/js/operations/Compress.js +++ b/src/js/operations/Compress.js @@ -304,28 +304,29 @@ var Compress = { password: Utils.strToByteArray(args[0]), verify: args[1] }, - file = "", unzip = new Zlib.Unzip(input, options), filenames = unzip.getFilenames(), - output = "
" + filenames.length + " file(s) found
\n"; + files = []; - output += "
"; + filenames.forEach(function(fileName) { + var contents = unzip.decompress(fileName); - window.uzip = unzip; - for (var i = 0; i < filenames.length; i++) { - file = Utils.byteArrayToUtf8(unzip.decompress(filenames[i])); - output += "
" + - "" + - "
" + - "
" + - Utils.escapeHtml(file) + "
"; - } + contents = Utils.byteArrayToUtf8(contents); - return output + "
"; + var file = { + fileName: fileName, + size: contents.length, + }; + + var isDir = contents.length === 0 && fileName.endsWith("/"); + if (!isDir) { + file.contents = contents; + } + + files.push(file); + }); + + return Utils.displayFilesAsHTML(files); },