Firefox will not allow some plain text files to be viewed inline

RESOLVED INCOMPLETE

Status

()

Firefox
File Handling
--
minor
RESOLVED INCOMPLETE
8 years ago
2 years ago

People

(Reporter: Acorn, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9

Most text files available by http can be viewed in firefox.  But some text files do not open in firefox.  Instead a "Opening <name-of-file>" dialog appears and allows the file to be opened with a helper app (e.g. gedit) or saved.

It would be really nice if these files could be viewed in firefox itself (most other text files are viewed).  At the least there should be a "view as text file inside firefox" option in the "Open with" pulldown menu.

An example of a page that cannot be viewed inline:
https://cvs.khronos.org/bugzilla/attachment.cgi?id=628

Note: the dialog identifies this as "plain text document" so firefox knows what it is.  There is a menu item in the "Open with" pulldown menu named "firefox-3.5.9" but it does not work.  It opens a dialog that says

/tmp/EGL_NK_swap_region2-1.txt could not be opened, because an unknown error occurred.  Try saving file to disk first and opening the file.

Saving the file and then opening the file in firefox works fine.  But it is inconvenient and seems like firefox could simply open the file on its own.

Here is an example of a URL of a text file that works fine (for comparison):
http://www.opengl.org/registry/specs/ARB/half_float_pixel.txt

Thanks!
-Acorn

Reproducible: Always

Steps to Reproduce:
1. paste "https://cvs.khronos.org/bugzilla/attachment.cgi?id=628" into address bar
2. try to view file in firefox
3.
Actual Results:  
Cannot view plain text file except by saving and/or opening with external app

Expected Results:  
should be able to see the plain text file
The given URL requires a login.
What are the http headers for that url, especially content-type and content-disposition ?

Comment 2

8 years ago
A non-private example:
https://crawl.develz.org/mantis/file_download.php?file_id=1644&type=bug

Content-type: text/plain
Content-disposition: attachment; filename="crash-David-20110209-132119.txt"

It probably makes sense to ask the user in such cases, but not allowing viewing the file in Firefox itself is a damn annoying thing, especially if you view a lot of files.

Another annoying case is a different but known mime type: text/x-csrc (detected by Firefox as "C source code") or text/x-diff ("differences between files").  Again, it might make sense to ask by default, but one of the options should be "open in Firefox".
>Content-disposition: attachment;
You want to ignore the content-disposition header, we have a bug for that

>text/x-csrc ... text/x-diff
This is a different case and we have a bug report for this as well.

I will mark this report invalid because the original reporter never answered
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE

Comment 4

5 years ago
Until recently, Firefox has sort-of randomly allowed me to view patch files in the browser, or popped up the dialog suggesting gedit as the default application to view the patch.

As of Firefox 19.0 (on a Fedora 18 box), I exclusively get the dialog (file type given is
"differences between files", represented as "text/x-diff" in mimeTypes.rdf). The dialog allows me to pick the default app, pick a different app, or save to disk.

What's conspicuously missing is the ability to specify that I want to view this type of file internally with Firefox itself (and to make that the default action for the future).

An example would be:

www.contrib.andrew.cmu.edu/~somlo/OSXKVM/seabios-mac-20130223.patch

Allowing me to (once again) view internally instead of forcing me to open in an external app would be a MAJOR usability improvement.

Please consider re-opening this bug !

Comment 5

5 years ago
Gabriel: until this is fixed, you want https://addons.mozilla.org/en-US/firefox/addon/open-in-browser/ which contains a workaround.

That extension's homepage references bugs https://bugzilla.mozilla.org/show_bug.cgi?id=57342 and https://bugzilla.mozilla.org/show_bug.cgi?id=258012 which can be considered semi-dupes of this one.

Comment 6

4 years ago
I can reproduce this bug at URL https://jira.reactos.org/secure/attachment/25619/dc_regions_clipping.diff
The attachment is Content-Type	text/x-diff;charset=UTF-8 and can't be viewed.
This URL is public.
version: Firefox 30.0.

Please reopen.
Gecko currently only supports text/plain, other types of text aren't supported. The reporter in comment#0 especially talks about plain text files (?text/plain) and i fail to see why your text/diff case should be identical.
You case is bug 196078

Comment 8

2 years ago
So, this came up today in the context of a diff file served as text/x-diff (displays fine in chrome, prompts to download in firefox).

The most recent comment on this bug links to a bug requesting text/plain handling.  I figured I'd comment here to note that while text/plain would be the bare-minimum, it sure would be nice if it was properly colourised. 

Also, the open in browser addon suggested above unfortunately does not allow overriding the prompt.
You need to log in before you can comment on or make changes to this bug.