Detect Markdown attachment files as text/plain so Firefox can display the content

RESOLVED FIXED

Status

()

enhancement
P2
blocker
RESOLVED FIXED
2 years ago
8 months ago

People

(Reporter: francois, Assigned: kohei)

Tracking

Production

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
Markdown files that end with .md are given the wrong mimetype (application/x-genesis-rom) and therefore cannot be viewed inline in Bugzilla:

  https://bugzilla.mozilla.org/attachment.cgi?id=8932125&action=edit

even though they're really plaintext files.

It would be great to add an override to text/plain at least because all new telemetry requests / data reviews now require attaching a .md file to a bug.
Assignee: attach-and-request → nobody
Component: Attachments & Requests → General
Product: Bugzilla → bugzilla.mozilla.org
QA Contact: default-qa
Version: unspecified → Production
This is blocking telemetry work, so marking as a P1.
Severity: normal → blocker
Priority: -- → P1
Priority: P1 → --
Priority: -- → P2
This is a very small change indeed, just special-casing the filename is probably sufficient. I'll take a look at this shortly.
Assignee: nobody → dylan
I think I have already solved this as part of Bug 602313. :francois, can you verify?

https://github.com/mozilla-bteam/bmo/blob/master/js/attachment.js#L417-L418
Assignee: dylan → kohei.yoshino
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Depends on: 602313
Flags: needinfo?(francois)
Resolution: --- → FIXED
(Reporter)

Comment 4

8 months ago
Posted file review.md
(Reporter)

Comment 5

8 months ago
No, it's still not fixed, see attachment 9011511 [details].
Status: RESOLVED → REOPENED
Flags: needinfo?(francois)
Resolution: FIXED → ---
Will figure out why.
Status: REOPENED → ASSIGNED
Looks like the original issue has been solved. The MIME type of the attached review.md is text/markdown, but Firefox cannot show the content while Chrome can. That’s a different issue: Bug 1319262. It’s possible for Bugzilla to detect .md file as text/plain, but given that the official MIME type is text/markdown, we should probably keep it, close this bug and fix the Firefox bug.
So... closing.
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago8 months ago
Resolution: --- → FIXED
(Reporter)

Comment 9

8 months ago
Given that the majority of people using our instance of Bugzilla are using Firefox, I think the work-around you mention makes sense (sending the text/plain mimetype when it's set to text/markdown). Bug 1319262 is P3, it's not going to get fixed anytime soon.
Yeah, the workaround is simple, but I’m still not sure what’s the best. Firefox (and other browsers) cannot preview Markdown files so some people may just want to download it and preview it in their favourite viewer, e.g. VS Code.
Maybe the best UX here is letting Bugzilla preview/render Markdown files instead showing the raw content, just like GitHub. Bugzilla already has a Markdown library for the Markdown comment support, so it should be possible to implement the Markdown file preview functionality.

Updated

8 months ago
See Also: → 1319262
(Reporter)

Comment 12

8 months ago
Rendering Markdown files could be nice, but since Markdown files are already quite readable and it's way easier to just display them as text, I'd personally go with that as a first step and revisit later if there's time/desire to enhance.

Given that Paolo has confirmed that it's unlikely to get fixed in Firefox in the near term, let's reopen this bug until a decision is made on the work-around.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Okay, let’s add a quick workaround to Bugzilla while waiting for the fix in Firefox.
Status: REOPENED → ASSIGNED
Summary: Markdown files are not recognized properly when attached to a bug → Detect Markdown attachment files as text/plain so Firefox can display the content
My PR doesn’t change the MIME type of the currently attached Markdown files. There are 46 bugs (only 5 open bugs) having Markdown file(s) so we can update them manually if needed.
Merged to master.
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.