Description of issue or problem I’m having:
Editors reported that when they uploaded a .csv dataset to the galleys of an article that it was being converted to .txt
Steps I took leading up to the issue (to reproduce the issue):
Create new version of published article
Add galley
Select dataset as the Article Component
Upload a .csv file
Publish the new version
Download the dataset
What I tried to resolve the issue:
The editor saved the csv in MS Excel and uploaded an .xlxs file as a work around. OJS successfully provided the .xlxs file for download, but the authors would prefer that the data be published as .csv.
I renamed the same file example.nothing and OJS (appropriately) saved it as example.nothing.txt
I ran diff against the contents of the original .csv file provided by the editor and the .txt file that OJS provided for download. Their contents were identical.
Application Version - e.g., OJS 3.1.2:
OJS 3.3.0.6
Thanks @rcgillis, that was really helpful.The mimetype is being stored as text/plain instead of text/csv in the files table. When I use file --mime-type -b against the .txt files download from OJS, I get text/csv. So the quick fix it seems like is going to be to just updating the the mimetype field in the files database.
Thanks, @IOPNdev - I’m going to get @NateWr to potentially weigh in on some suggested next steps, when he is available to comment, given that we’re seeing this in another context.
Can you tell me whether you’re able to reproduce this issue on Firefox and Chrome? Or just Firefox?
With the WMV issue, it looks like it is related to a quirk in the way that Firefox overrides the file extension based on the mimetype, rather than respecting the filename. At the moment I am waiting to see if there is any movement on Firefox’s side to adjust this. But if not we will implement a workaround in OJS.
@NateWr I’m still getting the same behavior in Chrome and Safari. I think other the main difference between what I’m seeing and the WMV issue (if I’m reading the WMV issue correctly) is that the the csv files are being recorded in the db incorrectly text/plain.
And updating the MIME type in the files tables seems to resolve the issue.
The mimetype is one part of it. But OJS should still return response headers with the correct filename (including extension). The issue is that when there is a mimetype/extension mismatch, the browser seems to override the downloaded filename.
Either way the solution will probably be the same, unless the browser’s roll back that behaviour (which seems to be relatively new).