Rely on KIO FUSE More Often
Summary
The old logic for choosing what URL (unchanged, KIO FUSE, KIO Exec) to send to the application tried as much as possible to not change the URL.
The logic was as follows:
- If the opening application used KIO, the URL was unchanged.
- If the opening application understood the URL scheme, so long as there was no userinfo sub-componenet specified in the URL (hinting authentication might be necessary), the URL was passed unchanged.
- Otherwise, pass the KIO FUSE URL (if KIO FUSE works). This would be in situations where the application understood the protocol but may not have access to the authentication details required (.e.g., userinfo sub-component specified without a URL), of if it didn't understand the protocol at all.
However, we've been bitten a few times for this:
- Some applications claim to support a protocol but in fact rely on external packages available at run-time to actually work. For example: 446077
- Dolphin does pass URLs which have no userinfo sub-component, but actually require authentication (.e.g, sftp://localhost) when opening a file. Whilst the example is contrived and likely not used in practice it makes ask if one of the in-variants that we rely on is true: if a resource (represented by a URL), requires authentication to be accessed, one will always be able to decipher if this is the case by seeing if a userinfo sub-component is present in the URL. Is this true? If not, is there anything else we can rely on?
The above two issues make me inclined to simplify the code dramatically, at the cost of potentially using KIO FUSE more than needed, which may be slower than using the applications internal understanding of the protocol. The benefit of this simplification is that accessing resources is always seamless, no matter the application that will open the resource in question.
Hence we simplify the logic to as follows:
- If the opening application uses KIO, the URL is unchanged.
- If the URL is a local file.
- Otherwise, pass the KIO FUSE URL (if KIO FUSE successfully mounts the URL, otherwise fall-back to KIOExec).
Test Plan
Compile Dolphin and kde-open5
(kde-cli-tools
) with this change.
-
Open an
sftp
resource in Dolphin and instruct Firefox to open an image within this resource. We should expect it to open a KIO FUSE URL. -
kde-open5 mailto:foo@bar.de
should open up your default email client (in my case, this is Thunderbird). -
Same as 2, but this time update the desktop file for Thunderbird such that
x-scheme-handler/mailto
is removed from theMimeType
key.