Open itlancer opened 3 weeks ago
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
@ajwfrost
Yes, sorry. All works fine except example at the start of the ZipArchive
documentation. Only example should be fixed.
Problem Description
ZipEntry
constructor andZipEntry.createFromFile()
have incorrect arguments.ZipEntry
documentation https://airsdk.dev/reference/actionscript/3.0/air/utils/ZipEntry.html says that second argument hasBoolean
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 hasByteArray
type. And actually it waitByteArray
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: https://github.com/airsdk/Adobe-Runtime-Support/discussions/3344
Steps to Reproduce
Create
ZipEntry
instance or create it viaZipEntry.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
.