Semanticmediawiki: filename parameter is not working in several formats

Created on 18 Dec 2019  路  14Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

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 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.

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 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)

bug

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:

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 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.

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

All 14 comments

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 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.

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:

image

No, this is not working for me:

grafik

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.

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. ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alex-mashin picture alex-mashin  路  4Comments

WolfgangFahl picture WolfgangFahl  路  3Comments

osnard picture osnard  路  3Comments

simontaurus picture simontaurus  路  3Comments

Larivact picture Larivact  路  4Comments