diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java index 35852f30..7240554c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -41,6 +41,8 @@ import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; /** * @author Ryszard Wiśniewski @@ -159,15 +161,28 @@ public class Androlib { } } - public void recordUncompressedFiles(ExtFile apkFile, Collection uncompressedFiles) throws AndrolibException { + public void recordUncompressedFiles(ExtFile apkFile, Collection uncompressedFilesOrExts) throws AndrolibException { try { Directory unk = apkFile.getDirectory(); Set files = unk.getFiles(true); + String ext; for (String file : files) { if (isAPKFileNames(file) && !NO_COMPRESS_PATTERN.matcher(file).find()) { - if (unk.getCompressionLevel(file) == 0 && !uncompressedFiles.contains(file)) { - uncompressedFiles.add(file); + if (unk.getCompressionLevel(file) == 0) { + + if (StringUtils.countMatches(file, ".") > 1) { + ext = file; + } else { + ext = FilenameUtils.getExtension(file); + if (ext.isEmpty()) { + ext = file; + } + } + + if (! uncompressedFilesOrExts.contains(ext)) { + uncompressedFilesOrExts.add(ext); + } } } }