kineapps / flutter_archive

Flutter plugin for creating and extracting ZIP files.
https://pub.dev/packages/flutter_archive
BSD 3-Clause "New" or "Revised" License
57 stars 43 forks source link

IllegalArgumentException: MALFORMED[1] #76

Closed JChPal closed 5 months ago

JChPal commented 5 months ago

I trying to extract an archive, some file are extracted but it stop with the following error (Android)

[        ] W/System.err(13320): java.lang.IllegalArgumentException: MALFORMED[1]
[        ] W/System.err(13320):     at java.util.zip.ZipCoder.toString(ZipCoder.java:65)
[        ] W/System.err(13320):     at java.util.zip.ZipFile.getZipEntry(ZipFile.java:626)
[        ] W/System.err(13320):     at java.util.zip.ZipFile.-$$Nest$mgetZipEntry(Unknown Source:0)
[        ] W/System.err(13320):     at java.util.zip.ZipFile$ZipEntryIterator.next(ZipFile.java:584)
[        ] W/System.err(13320):     at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:559)
[        ] W/System.err(13320):     at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:540)
[        ] W/System.err(13320):     at kotlin.collections.CollectionsKt__IteratorsJVMKt$iterator$1.next(IteratorsJVM.kt:18)
[        ] W/System.err(13320):     at com.kineapps.flutterarchive.FlutterArchivePlugin.unzip(FlutterArchivePlugin.kt:386)
[        ] W/System.err(13320):     at com.kineapps.flutterarchive.FlutterArchivePlugin.access$unzip(FlutterArchivePlugin.kt:39)
[        ] W/System.err(13320):     at com.kineapps.flutterarchive.FlutterArchivePlugin$unzip$1.invokeSuspend(Unknown Source:19)
[        ] W/System.err(13320):     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
[        ] W/System.err(13320):     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
[        ] W/System.err(13320):     at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
[        ] W/System.err(13320):     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
[        ] W/System.err(13320):     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
[        ] W/System.err(13320):     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
[        ] W/System.err(13320):     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
[        ] W/System.err(13320):     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
[   +1 ms] I/flutter (13320): PlatformException(unzip_error, MALFORMED[1], java.lang.IllegalArgumentException: MALFORMED[1], null)

Its stop just before a file which as an ü character in its name, not sure its the source of the error. I tryed to put

zipFileCharset: Charsets.UTF_8.name,

But it doesn't resolve the issue.

Do you know why this error occur ?

JChPal commented 5 months ago

I tried the solution linked in the kotlin code https://stackoverflow.com/questions/41908761/unzipping-a-file-with-special-characters-in-filenames-from-api24-upward

I worked with zipFileCharset: Charsets.ISO_8859_1.name,