mockingbot / react-native-zip-archive

Zip archive utility for react-native
MIT License
428 stars 157 forks source link

zipWithPassword produces empty zip and fails with an exception. #321

Open Volland opened 2 weeks ago

Volland commented 2 weeks ago

Describe the bug zipWithPassword produces an empty zip and fails with an exception. I am using default encryption

To Reproduce Steps to reproduce the behavior:

await zipWithPassword(backupDir, zipPath, await this.passwordProvider.getPassword());

Expected behavior A clear and concise description of what you expected to happen.

Env (please complete the following information):

Additional context zipWithPassword error { "stack": "Error: unable to zip\n at promiseMethodWrapper (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:13438:45)\n at zipWithPassword (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:649460:192)\n at ?anon0 (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:752800:64)\n at next (native)\n at asyncGeneratorStep (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:1520:19)\n at _next (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:1534:29)\n at tryCallOne (address at InternalBytecode.js:1:1180)\n at anonymous (address at InternalBytecode.js:1:1874)\n at apply (native)\n at anonymous (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:52701:26)\n at _callTimer (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:52580:17)\n at _callReactNativeMicrotasksPass (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:52625:17)\n at callReactNativeMicrotasks (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:52831:44)\n at callReactNativeMicrotasks (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:11086:48)\n at anonymous (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:10859:45)\n at guard (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:11058:15)\n at flushedQueue (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:10858:21)\n at callFunctionReturnFlushedQueue (http://192.168.1.104:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:10843:33)", "code": "zip_error", "message": "unable to zip", "domain": "RCTErrorDomain", "userInfo": null, "nativeStackIOS": [ "0 DevKin.debug.dylib 0x0000000109d179e4 RCTJSErrorFromCodeMessageAndNSError + 100", "1 DevKin.debug.dylib 0x0000000109cb9e98 41-[RCTModuleMethod processMethodSignature]_block_invoke_2.73 + 164", "2 DevKin.debug.dylib 0x0000000109c1d9c4 -[RNZipArchive zipFolderWithPassword:destinationPath:password:encryptionType:resolver:rejecter:] + 460", "3 CoreFoundation 0x00000001804b4760 _invoking + 144", "4 CoreFoundation 0x00000001804b1ac4 -[NSInvocation invoke] + 276", "5 CoreFoundation 0x00000001804b1d5c -[NSInvocation invokeWithTarget:] + 60", "6 DevKin.debug.dylib 0x0000000109cbb590 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1892", "7 DevKin.debug.dylib 0x0000000109cbf8a4 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBALN_117SchedulingContextE + 1848", "8 DevKin.debug.dylib 0x0000000109cbef78 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$0clEv + 136", "9 DevKin.debug.dylib 0x0000000109cbeee4 ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28", "10 libdispatch.dylib 0x0000000180170104 _dispatch_call_block_and_release + 24", "11 libdispatch.dylib 0x0000000180171978 _dispatch_client_callout + 16", "12 libdispatch.dylib 0x0000000180179b10 _dispatch_lane_serial_drain + 960", "13 libdispatch.dylib 0x000000018017a688 _dispatch_lane_invoke + 388", "14 libdispatch.dylib 0x0000000180185a84 _dispatch_root_queue_drain_deferred_wlh + 276", "15 libdispatch.dylib 0x00000001801850d0 _dispatch_workloop_worker_thread + 448", "16 libsystem_pthread.dylib 0x0000000100df3b74 _pthread_wqthread + 284", "17 libsystem_pthread.dylib 0x0000000100df2934 start_wqthread + 8" ], "__sentry_captured__": true

Volland commented 2 weeks ago

I noticed that a short password works. Is there any limitation on password size, etc ?

plrthink commented 1 week ago

Interesting, I dont expect this behavior, but how long the password you're trying?

Volland commented 1 week ago

i use ethereum signature as password it was 132 characters long

Something like that 0xc3aeaffccf89278c814c44c3b745a224b142a2da6ed82400c6a3a71309d9290956eb2229844cdba2d9efe5bd12bba1450025684ac3d767b725d9eb74409a7d7c1c