Put empty, uncompressed files on doNotCompress list (fixes #2333).

We do not want one empty file to cause all files with that extension to
not be compressed, so we always put the full filename on the doNotCompress
list in this case.
This commit is contained in:
Peter Retzlaff 2020-04-21 09:43:13 +02:00 committed by Connor Tumbleson
parent a04b9cd883
commit 5db19b3329

View File

@ -163,11 +163,13 @@ public class Androlib {
try {
Directory unk = apkFile.getDirectory();
Set<String> files = unk.getFiles(true);
String ext;
String ext = "";
for (String file : files) {
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0 && unk.getSize(file) != 0) {
ext = FilenameUtils.getExtension(file);
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
if (unk.getSize(file) != 0) {
ext = FilenameUtils.getExtension(file);
}
if (ext.isEmpty() || !NO_COMPRESS_PATTERN.matcher(ext).find()) {
ext = file;