Summary: | File associations are inherited in the incorrect order | ||
---|---|---|---|
Product: | [Applications] systemsettings | Reporter: | Adam Fontenot <adam.m.fontenot+kde> |
Component: | kcm_filetypes | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | faure, kde, nate |
Priority: | NOR | ||
Version: | 5.27.7 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/frameworks/kservice/-/commit/f424bd3aab78bf1e3a6c93aed7f4562d56c776a7 | Version Fixed In: | 6.0 |
Sentry Crash Report: | |||
Attachments: | plot of multiply inheriting mime types |
Description
Adam Fontenot
2023-10-04 03:12:40 UTC
I think you are right. The spec says in the section about selecting an application "The above process is repeated for each mimetype from the most specific to the least specific. Note in particular that an application that can handle a more specific type will be used in preference to an application explicitly marked as the default for a less-specific type." In the example text/plain is more specific then octet-stream A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kservice/-/merge_requests/167 Created attachment 162411 [details]
plot of multiply inheriting mime types
I'm attaching a directed graph I generated showing all mimetypes installed on my system that involve multiple inheritance, to make debugging potential issues with these easier. The problem with application/json is shown clearly.
Thanks! Git commit f424bd3aab78bf1e3a6c93aed7f4562d56c776a7 by David Redondo. Committed on 24/10/2023 at 10:19. Pushed by davidre into branch 'master'. Fix preferred apps order for multiple level mime inheritance We should prefer more specific mime types to less specific for that reason offers are sorted by inheritance level first. When constructing the offers for inherited types, the associated services for parent types are queried. However these can already contain services that are associated with a parent type of the parent type as the offers are build from the bottom-up starting with the least specific mime type. For example when constructing offers for a mime-type that inherits text/plain, the returned offers for text/plain will already contain services associated with application/octet-stream. By incrementing the inheritance levels instead of overwriting the relative ordering of inherited mime types is preserved. M +24 -0 autotests/kmimeassociationstest.cpp M +4 -4 src/sycoca/kbuildservicefactory.cpp M +1 -1 src/sycoca/kbuildservicefactory_p.h https://invent.kde.org/frameworks/kservice/-/commit/f424bd3aab78bf1e3a6c93aed7f4562d56c776a7 |