3liz / qgis-wfsOutputExtension

QGIS Server plugin to add Output Formats to WFS GetFeature request.
GNU General Public License v2.0
10 stars 6 forks source link

MIME-Type is not correct : application/zip for ODS files #11

Closed pcav closed 2 years ago

pcav commented 4 years ago

Apparently the exported ods file is unzipped, so it cannot be opened directly by LibreOffice.

Gustry commented 4 years ago

Sorry @pcav I don't understand the issue. Libreoffice wants to read a plain ODS file, not a zipped ODS. Why do you want a zipped ODS?

Maybe I'm missing something?

rldhont commented 4 years ago

ODS format is a zip file that contains an XML and other data like images.

The ODS file is generated by QGIS QgsVectorFileWriter.

Gustry commented 4 years ago

Yes, but I tried on Lizmap, I have an ODS file and it's working well in LibreOffice. I don't have any zipped file.

Are you sure it wasn't your file explorer which opening the file with the archive software?

pcav commented 4 years ago

so you can open an unzipped ODS file from LibreOffice? In my case it opened as xml.

Gustry commented 4 years ago

I'm not "unzipping" the ODS file, everything works fine.

@pcav Does it happen with other ODS files?

pcav commented 4 years ago

OK, your explanation makes sense to me. The problem stems from the fact that the browser by default suggests to open the ods with LO. Thanks.

Gustry commented 4 years ago

Ok, so I just checked the MIME Type on the file:

~/dev/qgis/server_plugin $ file --mime-type -b /home/etienne/Téléchargements/export_value_map.ods 
application/zip

So indeed, your webbrowser is following the Mime Type to choose the archive software. My firefox is following the extension .ods and doesn't open my archive software.

The content type in the plugin is well defined:

I didn't check if QGIS Server can set the correct MIME Type. Maybe @dmarteau has an idea?

Gustry commented 4 years ago

Ok, so I just checked the MIME Type on the file:

~/dev/qgis/server_plugin $ file --mime-type -b /home/etienne/Téléchargements/export_value_map.ods 
application/zip

And on a ODS file from scratch created in LO:

~/dev/qgis/server_plugin $ file --mime-type -b /tmp/test_ods.ods 
application/vnd.oasis.opendocument.spreadsheet
Gustry commented 2 years ago

if I'm not wrong, this has been fixed ? (with #16)

Gentle ping @pcav

u-cav commented 2 years ago

@Gustry the issue seems to be fixed on the user side. Firefox offers to open the file with LO, and the downloaded file can be opened directly.

The mimetype of the downloaded file is still:

application/zip

instead of:

application/vnd.oasis.opendocument.spreadsheet

rldhont commented 2 years ago

In the response headers provided by QGIS Server or Lizmap you would find application/vnd.oasis.opendocument.spreadsheet for content type. But between QGIS Server / Lizmap and the Browser there is some software that probably not recognize application/vnd.oasis.opendocument.spreadsheet content type and change it to application/zip because ODS is a zip file.

u-cav commented 2 years ago

@rldhont I would consider it fixed, since the behaviour is correct on the user end. Thanks!

Gustry commented 2 years ago

The MIME type is still indeed incorrect, but for the web browser, it seems alright indeed.