mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-07 05:06:59 +01:00
fix: normalize paths for uncompressed assets & unknown files
This commit is contained in:
parent
e35f66b0e0
commit
ca25a26944
@ -652,7 +652,8 @@ public class Androlib {
|
|||||||
|
|
||||||
// loop through unknown files
|
// loop through unknown files
|
||||||
for (Map.Entry<String,String> unknownFileInfo : files.entrySet()) {
|
for (Map.Entry<String,String> unknownFileInfo : files.entrySet()) {
|
||||||
String cleanedPath = BrutIO.sanitizeUnknownFile(unknownFileDir, unknownFileInfo.getKey());
|
String normalizedPath = BrutIO.normalizePath(unknownFileInfo.getKey());
|
||||||
|
String cleanedPath = BrutIO.sanitizeUnknownFile(unknownFileDir, normalizedPath);
|
||||||
File inputFile = new File(unknownFileDir, cleanedPath);
|
File inputFile = new File(unknownFileDir, cleanedPath);
|
||||||
if (inputFile.isDirectory()) {
|
if (inputFile.isDirectory()) {
|
||||||
continue;
|
continue;
|
||||||
@ -683,15 +684,16 @@ public class Androlib {
|
|||||||
File assetFileDir = new File(appDir, ASSET_DIRNAME);
|
File assetFileDir = new File(appDir, ASSET_DIRNAME);
|
||||||
|
|
||||||
for (String asset : files) {
|
for (String asset : files) {
|
||||||
String cleanedPath = BrutIO.sanitizeUnknownFile(assetFileDir, asset);
|
String normalizedPath = BrutIO.normalizePath(asset);
|
||||||
|
String cleanedPath = BrutIO.sanitizeUnknownFile(assetFileDir, normalizedPath);
|
||||||
|
|
||||||
File inputFile = new File(appDir, cleanedPath);
|
File inputFile = new File(appDir, cleanedPath);
|
||||||
if (inputFile.isDirectory()) {
|
if (inputFile.isDirectory()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.fine(String.format("Copying uncompressed asset: %s", asset));
|
LOGGER.fine(String.format("Copying uncompressed asset: %s", normalizedPath));
|
||||||
ZipEntry newEntry = getStoredZipEntry(cleanedPath, inputFile);
|
ZipEntry newEntry = getStoredZipEntry(normalizedPath, inputFile);
|
||||||
outputFile.putNextEntry(newEntry);
|
outputFile.putNextEntry(newEntry);
|
||||||
BrutIO.copy(inputFile, outputFile);
|
BrutIO.copy(inputFile, outputFile);
|
||||||
outputFile.closeEntry();
|
outputFile.closeEntry();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
|
import brut.util.BrutIO;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ public class ResUnknownFiles {
|
|||||||
private final Map<String, String> mUnknownFiles = new LinkedHashMap<>();
|
private final Map<String, String> mUnknownFiles = new LinkedHashMap<>();
|
||||||
|
|
||||||
public void addUnknownFileInfo(String file, String value) {
|
public void addUnknownFileInfo(String file, String value) {
|
||||||
mUnknownFiles.put(file, value);
|
mUnknownFiles.put(BrutIO.normalizePath(file), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getUnknownFiles() {
|
public Map<String, String> getUnknownFiles() {
|
||||||
|
Loading…
Reference in New Issue
Block a user