Skip to content

Commit 3dce59f

Browse files
author
Richard Hua
authored
Ignore OSX metadata when hashing updates (#561)
On Android, prevent hash mismatches by ensuring the hashing algorithm ignores OS X metadata (.DS_Store and __MACOSX). This addresses #472, and mirrors #471, which is the iOS side of the fix.
1 parent d2e150a commit 3dce59f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ private static void addContentsOfFolderToManifest(String folderPath, String path
2424
File folder = new File(folderPath);
2525
File[] folderFiles = folder.listFiles();
2626
for (File file : folderFiles) {
27+
String fileName = file.getName();
2728
String fullFilePath = file.getAbsolutePath();
28-
String relativePath = (pathPrefix.isEmpty() ? "" : (pathPrefix + "/")) + file.getName();
29-
if (file.isDirectory()) {
29+
String relativePath = (pathPrefix.isEmpty() ? "" : (pathPrefix + "/")) + fileName;
30+
31+
if (fileName.equals(".DS_Store") || fileName.equals("__MACOSX")) {
32+
continue;
33+
} else if (file.isDirectory()) {
3034
addContentsOfFolderToManifest(fullFilePath, relativePath, manifest);
3135
} else {
3236
try {

0 commit comments

Comments
 (0)