Open Bug 1319262 Opened 5 years ago Updated 7 months ago

Mime type text/markdown is downloaded instead of displayed

Categories

(Firefox :: File Handling, defect, P3)

49 Branch
All
Windows
defect

Tracking

()

Webcompat Priority ?
Tracking Status
firefox-esr52 --- affected
firefox55 --- affected
firefox56 --- affected
firefox57 --- affected
firefox70 --- affected
firefox71 --- affected
firefox72 --- affected
firefox76 --- affected
firefox88 --- affected
firefox89 --- affected
firefox90 --- affected

People

(Reporter: gaz, Unassigned)

References

()

Details

Attachments

(1 file, 1 obsolete file)

2.91 KB, text/markdown
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20161019084923

Steps to reproduce:

Clicked on a link to a README.md on my internal web server, which is using the correct MIME type of text/markdown


Actual results:

The file save dialogue opened up


Expected results:

The file should be displayed as if it is text/plain
OS: Unspecified → Windows
Hardware: Unspecified → x86_64
Attached file testcase.zip (obsolete) —
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0

I have tested this issue on Windows 10 x64 with the build mentioned in the description Firefox(49.0.2-20161019084923), the latest Firefox release (50.0) and the latest Nightly (53.0a1-20161123030208) and could not to reproduce it.
I have provided a testcase, with two html examples one with a link to an external README.md file and one with a link to the local README.md file. After loading each one of them in the browser, when clicking on the link, the READE.md file is loaded in the browser window.

Can you please retest this using a new clean Firefox profile, maybe even safe mode, to eliminate custom settings as a possible cause (https://goo.gl/PNe90E)?
Flags: needinfo?(gaz)
Attached file testcase
Status: UNCONFIRMED → NEW
Component: Untriaged → File Handling
Ever confirmed: true
Flags: needinfo?(gaz)
Hardware: x86_64 → All
Attachment #8814052 - Attachment is obsolete: true
The attached test case shows the issue for me, likely because Bugzilla serves the file with the "X-Content-Type-Options: nosniff" header.

I'm not sure about what we want to do for text MIME types if we don't rely on content sniffing.
Priority: -- → P3
I created http://textnet.io, which servers pages as `text/markdown` and Firefox is the only browser which doesn't display them correctly. They should really just be displayed like `text/plain`.
(In reply to mail from comment #4)
> I created http://textnet.io, which servers pages as `text/markdown` and
> Firefox is the only browser which doesn't display them correctly. They
> should really just be displayed like `text/plain`.

In Nightly 57, I do not receive any download/save popups in testing your site.

> User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0

(In reply to Emil Pasca [:emilpasca], Desktop Engineering QA from comment #1)
> Created attachment 8814052 [details]
> testcase.zip
> 
> User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101
> Firefox/49.0
> 
> I have tested this issue on Windows 10 x64 with the build mentioned in the
> description Firefox(49.0.2-20161019084923), the latest Firefox release
> (50.0) and the latest Nightly (53.0a1-20161123030208) and could not to
> reproduce it.
> I have provided a testcase, with two html examples one with a link to an
> external README.md file and one with a link to the local README.md file.
> After loading each one of them in the browser, when clicking on the link,
> the READE.md file is loaded in the browser window.
> 
> Can you please retest this using a new clean Firefox profile, maybe even
> safe mode, to eliminate custom settings as a possible cause
> (https://goo.gl/PNe90E)?

I also confirmed this bug in Firefox 55 and 57 on Linux. Markdown WebExtensions do not solve the problems.

However, I would like to suggest that Markdown files could be previewed as both plain text and Reader Mode.
That's because now I'm doing user-agent sniffing for Firefox and then deliver the page as text/plain.

> Markdown files could be previewed as both plain text and Reader Mode.

That would be cool!
This issue has been mentioned in a BMO bug: Bug 1421032. At least Chrome and Safari can display the content of a text/markdown file even with the `X-Content-Type-Options: nosniff` header. I think the priority is higher than P3.
Thanks for the reference. This area of the code doesn't currently have a team assigned, so as far as process goes, this means that P3 is the highest possible priority until someone volunteers to fix the bug. At that point, the state becomes assigned and P1 is set at the same time.

As I mentioned in comment 3, though, I don't know what the right solution is. Changing the default handling for all MIME types that start with "text/" is risky and it may have compatibility fallback. I don't know if we have precedent for special-casing individual text types, and if this may require changes across the codebase. Probably we should also look at what other browser do in general for "text/markdown" and other text types. So this is probably a bug that has to be looked at by someone experienced, and may require some time and effort.
See Also: → 1421032

https://direnv.net/docs/installation.md accessible from https://direnv.net/

HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Age: 35
Cache-Control: max-age=600
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 706
Content-Type: text/markdown
Date: Thu, 15 Aug 2019 01:11:02 GMT
ETag: W/"5d2702a5-593"
Expires: Thu, 15 Aug 2019 01:19:17 GMT
Last-Modified: Thu, 11 Jul 2019 09:34:29 GMT
Server: GitHub.com
Vary: Accept-Encoding
Via: 1.1 varnish
X-Cache: HIT
X-Cache-Hits: 1
X-Fastly-Request-ID: 5e97a91e88a3a654eeba8596688952232ea24311
X-GitHub-Request-Id: CD64:3D08:76FF7:80D7D:5D54B0BD
X-Proxy-Cache: MISS
X-Served-By: cache-itm18832-ITM
X-Timer: S1565831462.107076,VS0,VE0
Webcompat Priority: --- → ?

Markdown is a standard like JSON, i suggest to setup same feature for JSON.
View the renderer of markdown code in tab and see raw code in other tab.

Just run into this. I have some markdown being served with content-type: text/markdown, and Firefox offers it for download instead of displaying it as plain text. Setting content-disposition: inline has no effect.

Perhaps just displaying it as plain text would be a great first step? That would be infinitely better than the current situation.

I think technically any text/* MIME type would do well from being displayed as such.

I am having the same problem since a few weeks. Running Firefox 80.0.1 on MacOS Catalina (10.15.6).

I have the extension GitLab MarkDown Viewer installed and it worked like a charm until recently. I do not know exactly when it broke since I do not open markdown files in my browser every day, but I would say less than two month ago.

I tested with the extension deactivated : same issue.
I tested to set the helpers.private_mime_types_file key to ~/.mime.types, a file containing type=text/plain exts=md,mkd,mkdn,mdwn,mdown,markdown desc="Markdown document" without success.
I have the same problem with either distant files such as this one or local ones.

I would also suggest that FireFox's default behavior with markdown files would be to show them as plain text...

You need to log in before you can comment on or make changes to this bug.