GLIDEZIPUTIL

rohanhd
Kilo Contributor

Hi All,

I need to un gzip the attachment which has an image. I have got the attachment from the sys_attachment_doc table in 4k chunks. Ordered by position, base64 decoded the chunks and added them together to get a gzip version. I can also do this via the attachment API. Again I will get gzip version.

To unzip I wanted to use GlideZIPUTIL ZIP_UNZIPPING function. when I explore it using following

or (var i in GlideZipUtil) {

      gs.print(i);

}

I get

*** Script: addEntry

*** Script: CHARSET

*** Script: UTF_8

*** Script: _8859

*** Script: _8859_1

*** Script: ZIP_UNZIPPING

*** Script: WINDOWS_1252

*** Script: ZIP_WRITTEN

*** Script: ISO_8859_1

*** Script: ZIP_ZIPPING

But when I try accessing ZIP_UNZIPPING it gives me error

Attempted script access to inaccessible member denied - com.glide.util.ZipUtil:ZIP_UNZIPPING:

Evaluator: java.lang.SecurityException: Illegal access to field ZIP_UNZIPPING in class com.glide.util.ZipUtil

  Caused by error in script at line 21

  18: }

  19:

  20: this.ZipUtil = new GlideZipUtil();

==> 21: var img = ZipUtil.ZIP_UNZIPPING(base); //won't let me access ZIP_UNZIPPING

  22:

  23: quote = quote + "<tr><td >"+ img +"</td></tr>" //trying to print image

  24:

17 REPLIES 17

austinbuono
ServiceNow Employee
ServiceNow Employee

Unfortunately that is not working.  The error returned is: Wrong format or corrupted file

Any further assistance would be greatly appreciated.

Thanks! 

In what scenario, does it happen ?

 

when you attach the file to Datasource as zip and then use your transform map?

austinbuono
ServiceNow Employee
ServiceNow Employee

Correct when I do that and manually select 'Load All Records' it returns an error. 

If I manually unzip file and then take the unzipped excel and attach it to a data source as an excel it will run as expected.

Thanks!

find_real_file.png

I think your issue is the zipped file is xlsx. If the zipped file is xls then it works. 

btw which version are you on? Istanbul, Jakarta Kingston? I have verified in Kingston, but earlier in Fuji etc too this has worked. So I think loading records from a datasource zipped file shouldn't be an issue.