Skip to content

Commit 8b874eb

Browse files
danilocanalleplrthink
authored andcommitted
normalizeFilePath on targets to fix crc check
1 parent e189b6b commit 8b874eb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const normalizeFilePath = (path) =>
1010
path.startsWith("file://") ? path.slice(7) : path;
1111

1212
export const unzip = (source, target, charset = "UTF-8") => {
13-
return RNZipArchive.unzip(normalizeFilePath(source), target, charset);
13+
return RNZipArchive.unzip(normalizeFilePath(source), normalizeFilePath(target), charset);
1414
};
1515
export const isPasswordProtected = (source) => {
1616
return RNZipArchive.isPasswordProtected(normalizeFilePath(source)).then(
@@ -21,7 +21,7 @@ export const isPasswordProtected = (source) => {
2121
export const unzipWithPassword = (source, target, password) => {
2222
return RNZipArchive.unzipWithPassword(
2323
normalizeFilePath(source),
24-
target,
24+
normalizeFilePath(target),
2525
password
2626
);
2727
};
@@ -35,30 +35,30 @@ export const zipWithPassword = (
3535
return Array.isArray(source)
3636
? RNZipArchive.zipFilesWithPassword(
3737
source.map(normalizeFilePath),
38-
target,
38+
normalizeFilePath(target),
3939
password,
4040
encryptionMethod
4141
)
4242
: RNZipArchive.zipFolderWithPassword(
4343
normalizeFilePath(source),
44-
target,
44+
normalizeFilePath(target),
4545
password,
4646
encryptionMethod
4747
);
4848
};
4949

5050
export const zip = (source, target) => {
5151
return Array.isArray(source)
52-
? RNZipArchive.zipFiles(source.map(normalizeFilePath), target)
53-
: RNZipArchive.zipFolder(normalizeFilePath(source), target);
52+
? RNZipArchive.zipFiles(source.map(normalizeFilePath), normalizeFilePath(target))
53+
: RNZipArchive.zipFolder(normalizeFilePath(source), normalizeFilePath(target));
5454
};
5555

5656
export const unzipAssets = (source, target) => {
5757
if (!RNZipArchive.unzipAssets) {
5858
throw new Error("unzipAssets not supported on this platform");
5959
}
6060

61-
return RNZipArchive.unzipAssets(normalizeFilePath(source), target);
61+
return RNZipArchive.unzipAssets(normalizeFilePath(source), normalizeFilePath(target));
6262
};
6363

6464
export const subscribe = (callback) => {

0 commit comments

Comments
 (0)