Closed Bug 1787765 Opened 2 years ago Closed 2 years ago

Firefox doesn't open log files as text when a non-text/plain mimetype is associated with them via handlers.json or the OS mimetypes associations

Categories

(Firefox :: File Handling, defect)

Firefox 104
x86_64
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 196078

People

(Reporter: philippb.ontour, Unassigned)

References

Details

Steps to reproduce:

Open a plain text file with ".log" extension (from www or local file)

Actual results:

An endless number of tabs opens, and as many 0-byte temp files are created

Expected results:

Text file is shown

The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Tabbed Browser

This bug looks much related to 218257.

Looking at "about:preferences -> General -> Applications" I can see "application log" is a specific file type.
Other file types there have the option "Open in Firefox", which seems to Firefox-internal.
The log file type has instead "Use Firefox Web-Browser (default)", which looks as its system provided (Xubuntu 18).
It seems, the file open action is passed to the Desktop's file open action, then passed back to Firefox, then the filetype is detected again, resulting in a loop.

Component: Tabbed Browser → Untriaged
Component: Untriaged → File Handling
OS: Unspecified → Linux
Hardware: Unspecified → x86_64

could NOT reproduce on Windows 11, seems to be Linux-related

Yes, this is a known issue. The workaround would be to set the action for that filetype to "save to disk" or to manually associate a different helper application.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE

That answer is somewhat surprising. I don't think I am the only person that wants to view text (.log) files directly in the browser.
This is an essential part of my daily work flow working e.g. with Jira.

(In reply to philippb.ontour from comment #5)

So to be clear, I duped to the generic bug around these infinite loops for files that Firefox cannot open (though I have previously tried to fix this in bug 1750253, it depends on being able to determine we are the default application for the file, and for whatever reason it sounds like that is not happening here).

The generic solution to that problem is "don't make Firefox the default for files it cannot open". Like, people on Windows asking Firefox to open MS office documents or w/e just doesn't make too much sense.

I don't think I am the only person that wants to view text (.log) files directly in the browser.
This is an essential part of my daily work flow working e.g. with Jira.

If you're really saying "Firefox should be able to open .log files on my computer", that's a slightly different kettle of fish.

If the mimetype the OS gives us for this local file is not text/plain, then how should the browser know it can open the file as text?

Does it work if you rename the file to .txt, and/or edit your mime configuration so it doesn't use whatever magical mimetype it's using right now?

Status: RESOLVED → REOPENED
Ever confirmed: true
Flags: needinfo?(philippb.ontour)
Resolution: DUPLICATE → ---

Thanks for clarification! I already wondered if this is related to my local mimetype setup. I will dig a bit deeper there.

Flags: needinfo?(philippb.ontour)

Yes, it works if the file does not have an ending that matches anything in Settings->General->Applications.
Any hint how this list is populated would be much appreciated!

(In reply to philippb.ontour from comment #8)

Yes, it works if the file does not have an ending that matches anything in Settings->General->Applications.
Any hint how this list is populated would be much appreciated!

There's a local file in your profile called handlers.json that has your locally saved associations (formed e.g. when previously downloading/opening files where we've asked what to do, or if you used the downloads panel context menu and said "always open files like this"). In terms of the mimetype to file extension associations, they come from your system's mime database (/etc/mime.types on Linux, I believe, and possibly elsewhere on modern systems... I'm not a Linux expert).

The severity field is not set for this bug.
:Gijs, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(gijskruitbosch+bugs)

bug 196078 is the older bug to just render text/* as text/plain in general, which presumably would help here...

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Flags: needinfo?(gijskruitbosch+bugs)
Keywords: dupeme
Resolution: --- → DUPLICATE
Summary: Endless Tabs opened when trying to open an log file → Firefox doesn't open log files as text when a non-text/plain mimetype is associated with them via handlers.json or the OS mimetypes associations
You need to log in before you can comment on or make changes to this bug.