Menu

#2110 Unable to export in .xlsx format using API call

3.0.2-1
more-info-needed
None
User Interface
Critical
3.0.1
defect
2022-09-21
2022-09-15
No

Hello,

When making an API call from iTop, to export an excel sheet (.xlsx), the file seems to be corrupt and not working as intended. The file is created, but we are unable to open (see attachment)

Here is the URL we're using to make the call:
https://cms-sgc.dev.global.gc.ca/uat/web/webservices/export-v2.php?login_mode=basic&charset=ISO-8859-15&format=xlsx&expression=SELECT%20Location&fields=name,floc,id

Please note that CSV and PDF format are working as intended. We're only noticing this issue with XLSX.

1 Attachments

Discussion

  • Pierre Goiffon

    Pierre Goiffon - 2022-09-15

    Hello,
    This might be data dependent... Can you share the generated XLSX file ? Did you try with a query giving less results ?

     
  • Pierre Goiffon

    Pierre Goiffon - 2022-09-15
    • status: new --> more-info-needed
     
  • Hipska

    Hipska - 2022-09-15

    Are there by any chance some Locations with special characters not supported in ISO-8859-15?

    Do you have the same problem by selecting a single Location with no special characters? Use &expression=SELECT%20Location%20WHERE%20id=<SOME_ID>

     
    • Kirushoth Kirubaharan

      I have the same issue when filtering based on id (See attachment)

       
  • Kirushoth Kirubaharan

    See attached export

     
  • Kirushoth Kirubaharan

    We've never had this issue in the past. I don't believe this is an issue with the size of data. Like I said, we're able to export the same results in different formats - CSV, PDF

     
  • Pierre Goiffon

    Pierre Goiffon - 2022-09-16

    I was more thinking of a specific data causing the error than a size problem : encoding issue for example (Hipska pointed out the ISO Latin-9 charset for example).

    The XLSX cannot be opened nor repaired by Excel.

    I tried to find online validators but no luck :( Every URL I found are dated at least 10 years back, and aren't valid anymore :( Seems something can be done with the SDK ?

    If I rename the file to .zip, I get an error when unzipping... It might be what is causing the error ?
    Zipping again the uncompressed file and renaming the zip file to .xlsx : I can now open the file in Excel !
    So yes, really seems the issue is located on the compressing part of the process...

     
  • Hipska

    Hipska - 2022-09-16

    Or server updated / configuration changed causing the browser to unzip the content while downloading?

     
    👍
    1
    • Pierre Goiffon

      Pierre Goiffon - 2022-09-16

      A reverse proxy could indeed, good idea !

       
  • Kirushoth Kirubaharan

    So this seems to be out-of-box issue, if the file is being "unzipped" while downloading. How do we resolve this?

     
  • Kirushoth Kirubaharan

    We noticed that on iTop 2.7.4 the export worked as expected. Here are our other configs:
    PHP 7.3
    mariadb 10.3

     
    • Pierre Goiffon

      Pierre Goiffon - 2022-09-19

      Hello,
      What do you mean "worked as expected" ? You had the issue on another iTop instance ?

       
  • Kirushoth Kirubaharan

    I believe this is an iTop specific issue

     
  • Pierre Goiffon

    Pierre Goiffon - 2022-09-19

    You may try an export directly on the server using the CLI tool ?

    The XLSX files are generated using application/xlsxwriter.class.php which uses itself the ZipArchive class.

     
  • Kirushoth Kirubaharan

    Yes, I'm referring to two distinct instances - one that had 2.7.4 installed and 3.0.1 installed on the other.

     

Log in to post a comment.