The filename parameter, present in CSV, BibTex and JSON formats - for example, is not working anymore. When clicking on the link generated from #ask, the filename is not defined as it should.
See the example on the help page about the CSV_format:
https://www.semantic-mediawiki.org/wiki/Help:CSV_format#Change_file_name
Or, click on the JSON or CSV links here (and note the file name and the file extension):
https://wikincat.org/wiki/Wikis_for_libraries_(2010)
(CSV is defined with |filename={{#sub:{{PAGENAMEE}}|0|50}}.csv)
I've seen this before and I have a fix somewhere (+ test), I hope to
be able to find the patch after the holidays.
On 12/19/19, Jaider Andrade Ferreira notifications@github.com wrote:
Setup and configuration
- SMW version: 3.1.1
- MW version: 1.33.0
- PHP version: 7.3.12
- MySQL version: 5.6.45-86.1
Issue
The
filenameparameter, present in CSV, BibTex and JSON formats - for
example, is not working anymore. When clicking on the link generated from
#ask, the filename is not defined as it should.Steps to reproduce
See the example on the help page about the CSV_format:
https://www.semantic-mediawiki.org/wiki/Help:CSV_format#Change_file_name
Or, click on the JSON, CSV or BibTex links here (and note the file name and
the file extension):
https://wikincat.org/wiki/Wikis_for_libraries_(2010)
(CSV is defined with|filename={{#sub:{{PAGENAMEE}}|0|50}}.csv)--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4375
Issue replicated on sandbox.
the filename is not defined as it should.
Now we have to interpret this. What is the expected file name?: "some-2Dnice.csv" or "some-nice.csv". What however is still failing for sure is the fact that "filename=" is prepended to the filename.
What is the expected file name?: "some-2Dnice.csv" or "some-nice.csv". What however is still failing for sure is the fact that "filename=" is prepended to the filename.
I'm not sure what you mean when using the link, I now get the expected:

No, this is not working for me:

If I remove ".csv" from the |filename= parameter I get "some-nice" without file extension however now with sane chars.
No, this is not working for me:
I'm using WIN and I expect you to use LNX which may cause the difference here, anyway I'm unable to verify the issue on my test setup.
Another difference is that I am using LibreOffice in contrast to OpenOffice. Not sure if these two are at play since they are only consumers.
At least https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/560 is fixed now - also on *NIX.
The difference between "spreadsheet" and "csv" is however that the former automatically adds the file extension whereas the latter requires the file extension to be added. I suspect the issue is somehow based around this detail.
"csv" in combination with the "spreadsheet" format is working for the same reason.
I really believe that there is still something in the water.
I really believe that there is still something in the water.
I wouldn't deny that but the root issue has been fixed as outlined in #4390. Maybe someone can have a look at what happens with the CSV output here but as I said I cannot replicate the issue and I have fixed the root cause of "the filename parameter is not taken into account" hence the issue is resolved for me.
"spreadsheet" and "csv" is however that the former automatically adds the file extension
For example, the JSON printer does some extra transformations [0] while the CSV [1] format simply returns the $this->params['filename'].
The spreadsheet also does some transformations [2].
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Query/ResultPrinters/JsonResultPrinter.php#L50-L60
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Query/ResultPrinters/CsvFileExportPrinter.php#L48-L49
[2] https://github.com/SemanticMediaWiki/SemanticResultFormats/blob/master/formats/spreadsheet/SpreadsheetPrinter.php#L76-L77
Thanks. I am using a pretty conservative (old) *NIX environment. Probably best to have more feedback from other *NIX users based on the examples provided on sandbox. Based on the feedback I will either create a separate issue or not.
@jaideraf @JeroenDeDauw
Thank you guys! Welcome back, James! Good to see you here. :smiley:
I confirm, it's fixed to me (I am using Ubuntu 19.10, Chrome 79.0.3945.88).
CSV, JSON, BibTex and spreadsheet (xlsx), all fixed.
@jaideraf Thanks for confirming. I am still on 16.04 which is eol soon. ...
Most helpful comment
I've seen this before and I have a fix somewhere (+ test), I hope to
be able to find the patch after the holidays.
On 12/19/19, Jaider Andrade Ferreira notifications@github.com wrote: