Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZipEntry incorrect arguments #3416

Open
itlancer opened this issue Aug 21, 2024 · 2 comments
Open

ZipEntry incorrect arguments #3416

itlancer opened this issue Aug 21, 2024 · 2 comments
Labels

Comments

@itlancer
Copy link

Problem Description

ZipEntry constructor and ZipEntry.createFromFile() have incorrect arguments.
ZipEntry documentation https://airsdk.dev/reference/actionscript/3.0/air/utils/ZipEntry.html says that second argument has Boolean type.
Also in AIR_SDK/frameworks/libs/air/airglobal.swc you can see the same.

But in ZipArchive https://airsdk.dev/reference/actionscript/3.0/air/utils/ZipArchive.html reference example you can see that second argument has ByteArray type.
And actually it wait ByteArray argument.

Tested with multiple AIR SDK versions, even with latest AIR SDK 51.1.1.3 with devices with different OS versions and different applications.
Same issue in all cases.

Related issue: #3344

Steps to Reproduce

Create ZipEntry instance or create it via ZipEntry.createFromFile().

Actual Result:
Second argument expected as Boolean.

Expected Result:
Second argument expected as ByteArray.
Documentation will be fixes also.

Known Workarounds

Ignore IDE/compiler warnings and pass ByteArray.

@itlancer itlancer added the Bug label Aug 21, 2024
@ajwfrost
Copy link
Collaborator

As it stands currently .. the only thing that's actually "wrong" is the example at the start of the ZipArchive documentation. In code, the ZipEntry constructor has two arguments, 'name' and (optionally) 'compress'. There's no way to set the data within the ZipEntry object within its constructor...

The ZipEntry.createFromFile() function does give a utility method to create a ZipEntry object using the file name and compression argument, and it then reads the file data into the data property. So we could equally create a ZipEntry.createFromByteArray() function that took a name, compression argument and a ByteArray to use as the data. But equally you could just do this:

 var fZip : File = File.documentsDirectory.resolvePath("myZip.zip");
 var zip : ZipArchive = new ZipArchive();
 var zipEntry : ZipEntry = new ZipEntry("file_one.txt");
 zipEntry.data = bytes;
 zip.entries.push( zipEntry );
 zip.save(fZip);

So -> I'm thinking we should just update that example code so that it's the above. But your "expected result" seems to suggest you'd prefer we have a constructor with a ByteArray option?

thanks

@itlancer
Copy link
Author

@ajwfrost
Yes, sorry. All works fine except example at the start of the ZipArchive documentation. Only example should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants