From 912679541c6a23d6373dd29eff9f13a0aae528e0 Mon Sep 17 00:00:00 2001 From: plrthink Date: Sat, 17 Aug 2019 22:59:12 +0800 Subject: [PATCH] fix zip on android --- .../src/main/java/com/rnziparchive/RNZipArchiveModule.java | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java b/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java index ed7a8dc..d624b6a 100644 --- a/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java +++ b/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java @@ -327,7 +327,7 @@ public void zipWithPassword(String fileOrDirectory, String destDirectory, String parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); - String encParts[] = _encryptionMethod.split("-"); + String encParts[] = encryptionMethod.split("-"); if (password != null && !password.isEmpty()) { parameters.setEncryptFiles(true); @@ -340,7 +340,7 @@ public void zipWithPassword(String fileOrDirectory, String destDirectory, String } else { parameters.setAesKeyStrength(Zip4jConstants.ENC_METHOD_STANDARD); } - } else if (_encryptionMethod.equals("STANDARD")) { + } else if (encryptionMethod.equals("STANDARD")) { parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD); Log.d(TAG, "Standard Encryption"); } else { diff --git a/index.js b/index.js index 694439b..970eda3 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ export const unzipWithPassword = (source, target, password) => { return RNZipArchive.unzipWithPassword(source, target, password) } -export const zipWithPassword = (source, target, password, encryptionMethod) => { +export const zipWithPassword = (source, target, password, encryptionMethod = '') => { return RNZipArchive.zipWithPassword(source, target, password, encryptionMethod) }