-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[github] Downloading markdown file adds .html prefix #382
Comments
Same thing happens with .txt files. |
Hey @brianjgeiger - are you still having this problem? I can't seem to replicate it. |
I'll give it a try, but I suspect it's been incidentally fixed by now. |
No, not fixed, but has to be on a github store, not an OSF store. OSF store works properly still. Verified on Production. See https://osf.io/nqxz6/files/ |
Are you using Chrome? Try with Safari. I will update the description of the bug to indicate that. |
That'll just be because your system is set to open HTML files in Chrome instead of Safari. |
I think I have a fix for the .txt file case. For markdown files, I believe we need to add a file with new mimetypes. @sloria, do you have a preference on where in the OSF hierarchy such a file would go? |
Going to poke around the github api first to see if they provide content-type. |
Oh, this is a lot worse than I thought, or it's gotten worse in recent months. On staging, if I try to download, say, a png, it tries to do it as html. Production as well. |
I can't find a way with the Github API to get the mimetype of the file. With using the default mimetype guessing, it fixes most of the cases. Markdown gets labelled as a text file rather than just .md or .markdown, so probably we will still want to use a custom mime file for this and any future cases as new filetypes are added. There is some system-dependence here, so linux may have a different set of mimetypes than OS X does. But for the most flexibility, at least having our own file will let us handle the cases where things aren't dealt with by the built-in stuff. |
Can't we just force this? @Lyndsy you dealt with something similar, right? On Thu, Sep 25, 2014 at 3:42 PM, Brian J. Geiger [email protected]
|
That's essentially what this is doing. You have to send the content-type with the file. Most of the plugins already have this info, but the github api doesn't seem to provide it. Chrome apparently guesses the mimetype come what may, which is why nobody noticed, but Safari does not, or something about the content-type that is being sent keeps Safari from wanting to. The above commit handles cases of file extensions that the OS knows about, it's just that .md isn't one of those. |
There was a default case that was too specific (checking for file extension being missing). I made it fit with what we're doing now, and it works much better. |
Fix link for CenterForOpenScience#382 to point to CenterForOpenScience#382, not CenterForOpenScience#384. Mistake introduced in CenterForOpenScience#2286.
Steps
Expected
You will get two files with essentially the same name (with an operating system appended marker to keep them from overwriting or whatever)
Actual
The OSF file downloads as filename.md. The github file downloads as filename.md.html
Possible Cause
Usually this sort of thing is that the mime type is not set properly for download.
Environment
This bug was found with Safari 7.1 (9537.85.10.17.1) on Mac OS X 10.9.5.
The text was updated successfully, but these errors were encountered: