Brave Browser messed up my local MIME database on Fedora Linux

Description of the issue:

Brave created this user-local MIME definition for its default profile

~/.local/share/mime/packages/brave-bknofkbphlmjdamhfgnibeebjmfjklfh-Default.xml

This file registers four wildcard MIME types:

audio/*
image/*
text/*
video/*

These wildcard registrations appear to interfere with MIME type detection for other applications. In particular, the image/* registration causes .png files to be incorrectly associated with image/* instead of image/png, which can cause other applications relying on the system MIME database to handle .png files incorrectly.

Removing these four wildcard MIME registrations and running:

update-mime-database ~/.local/share/mime

restores the expected MIME associations.

The issue may return if Brave recreates or updates this MIME registration file.

How can this issue be reproduced?

  1. Install Brave from the official Brave Linux package repository.
  2. Launch Brave and use the default profile.
  3. Check the MIME package created by Brave: ~/.local/share/mime/packages/brave-bknofkbphlmjdamhfgnibeebjmfjklfh-Default.xml
  4. Run: update-mime-database ~/.local/share/mime
  5. Check the MIME type of any .png file: xdg-mime query filetype /path/to/example.png.
  6. The result is image/* instead of image/png.

Actual result:
xdg-mime query filetype /path/to/example.pngimage/*

Expected result:
xdg-mime query filetype /path/to/example.pngimage/png

Brave Version( check About Brave): 1.94.121

Additional Information:

Update on this issue:

I found the actual source of the problem: the Kimi web app/PWA installed through Brave.

The web app creates this desktop entry:

~/.local/share/applications/brave-bknofkbphlmjdamhfgnibeebjmfjklfh-Default.desktop

Kimi’s PWA manifest declares file_handlers with wildcard MIME types such as image/*, text/*, audio/*, and video/*, along with specific types such as EPUB, JSON, PDF, DOC, etc. This is why the generated .desktop file contains:

MimeType=audio/*;image/*;text/*;video/*;...

Chromium’s Linux OS integration code (chrome/browser/shell_integration_linux.cc) uses these file_handlers to generate two files:

  • A .desktop shortcut under ~/.local/share/applications/

  • A MIME registration XML file under ~/.local/share/mime/packages/

Main issue

The main issue appears to be in Chromium’s MIME registration logic. GetMimeTypesRegistrationFileContents() takes the web app’s file_handlers and generates XDG MIME registration entries such as image/*, including glob patterns like *.png and *.apng.

Injecting *.apng, *.png, … globs under image/* with weight 50 into the user’s MIME database hijacks name-based MIME resolution for applications using that database. For example:

foo.png → image/*

instead of the expected:

foo.png → image/png

How to reproduce

  1. Go to Kimi.ai and install Kimi as a PWA/web app in Brave.

  2. Brave creates a .desktop file under ~/.local/share/applications/ and a corresponding MIME registration XML file under ~/.local/share/mime/packages/.

  3. Run: update-mime-database ~/.local/share/mime

  4. Check the MIME type of a PNG file:
    xdg-mime query filetype /path/to/example.png

Actual result:

image/*

Expected result:

image/png

This appears to be a Chromium/Chrome Linux OS integration issue that affects other applications relying on the user’s XDG MIME database, not just Brave itself.