Skip to content

Commit

Permalink
Merge pull request #20 from tapthaker/master
Browse files Browse the repository at this point in the history
Fix a bug where all files inside META-INF were skipped instead of the signature files
  • Loading branch information
WindySha authored Oct 27, 2024
2 parents 1eddf66 + b241fdd commit d62b314
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/main/java/com/wind/meditor/core/FileProcesser.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public static void processApkFile(String srcApkPath, String dstApkPath, Modifica
// Log.d(" zipEntryName = " + zipEntryName);

// ignore signature files, we will resign it.
if (zipEntryName.startsWith("META-INF")) {
if (FileTypeUtils.isSignatureFile(zipEntryName)) {
Log.i("ignore signature file: " + zipEntryName);
continue;
}

Expand Down
8 changes: 8 additions & 0 deletions lib/src/main/java/com/wind/meditor/utils/FileTypeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public static boolean isApkFile(String filePath) {
return false;
}

public static boolean isSignatureFile(String filePath) {
return filePath.startsWith("META-INF/") &&
(filePath.endsWith(".RSA") ||
filePath.endsWith(".DSA") ||
filePath.endsWith(".SF") ||
filePath.endsWith(".MF"));
}

public static String getFileHeader(String filePath) {
String cachedHeader = fileHeaderCache.get(filePath);
if (cachedHeader != null && !cachedHeader.isEmpty()) {
Expand Down

0 comments on commit d62b314

Please sign in to comment.