Closed Bug 609719 Opened 15 years ago Closed 15 years ago

hg.mozilla.org raw file-viewer should serve SVG files with mimetype image/svg+xml

Categories

(mozilla.org Graveyard :: Server Operations, task)

task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dholbert, Assigned: aravind)

References

()

Details

STEPS TO REPRODUCE: Compare the following URLs: http://hg.mozilla.org/mozilla-central/raw-file/c0dbdafa583c/layout/reftests/backgrounds/no-intrinsic-size.svg http://people.mozilla.org/~dholbert/tests/hgweb-mimetype/no-intrinsic-size.svg ACTUAL RESULTS: The former just displays the plain text of the SVG source; the latter renders correctly (green bar across the screen). The files themselves are identical. It's just that we're serving the SVG with the incorrect mimetype, on hg web. I don't know the internals of hgweb, but if it's at all possible to customize it like apache with a .htaccess file, then we should be able to fix this by adding the "SVG" chunk of https://developer.mozilla.org/en/sample_.htaccess_file (if not more).
hgweb doesn't have any facility for this, it simply serves files as text/plain unless they look like binary files, in which case it uses application/octet-stream: http://selenic.com/repo/hg-stable/file/f766882000c7/mercurial/hgweb/webcommands.py#l55
Ted, I think you read the code wrong. The function in question calls mimetypes.guess_type() from the standard library to try and determine the mime type. If that function doesn't come up with anything, we try to determine binary or not and use application/octet-stream or text/plain. mimetypes.guess_type() uses several well-known locations in the filesystem to find files that help determining mimetype from extensions, such as /etc/mime.types. The easiest recourse would be to have server ops add something to one of those file. This could be /etc/httpd/mime.types, /etc/apache/mime.types and several locations, as shown at the top of the stdlib mimetypes (/usr/lib/python2.6/mimetypes.py on my boxes).
Assignee: nobody → server-ops
Component: Hg: Customizations → Server Operations
QA Contact: hg.customizations → mrz
Oh heh, it's two lines above what I linked and I totally missed it.
Assignee: server-ops → aravind
Fixed the mime.types file on the webheads serving this content. It all shows up as green now.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Verified fixed -- thanks!
Status: RESOLVED → VERIFIED
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.