Bug 461756 - kde-open should support opening file://hostname/path/to/file
Summary: kde-open should support opening file://hostname/path/to/file
Status: CONFIRMED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.109.0
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-13 07:08 UTC by Yuxin Wu
Modified: 2025-03-04 17:07 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuxin Wu 2022-11-13 07:08:14 UTC
SUMMARY

If we run `ls --hyperlink=always`, ls will print file names with hyperlinks that can be seen in supported terminals (e.g. gnome-terminal, konsole (by default disabled)). 
The hyperlink for files look like "file://hostname/path/to/file" - even if files are on localhost.

However, `kde-open` (which is used by `xdg-open`) cannot open such URLs, even if the file is on localhost. I'd like to request support for such URLs.


STEPS TO REPRODUCE
1. `kde-open file:///usr/bin` succeeds and opens the directory with default application (e.g. dolphin)
2. `kde-open file://$HOST/usr/bin` fails.

EXPECTED RESULT
(2) should also succeed.


SOFTWARE/OS VERSIONSs
Linux/KDE Plasma: 5.26.3
(available in About System)
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
I tried adding a new .desktop file with a custom executable, and set it to handle mimetype `x-scheme-handler/file`. 
However this does not work. My custom executable is run for `file:///usr/bin`, but not `file://$HOST/usr/bin`.
Comment 1 ariasuni 2023-08-28 01:41:03 UTC
I have the same issue.


SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.12-arch1-1 (64-bit)
Graphics Platform: X11


ADDITIONAL INFORMATION
I discovered this bug because [this document on hyperlinks in terminal emulators](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#file-uris-and-the-hostname) recommends using file protocol with hostname, but it doesn’t work in Konsole because of `kde-open`.
Comment 2 ariasuni 2023-08-28 02:18:12 UTC
I’ve done some investigation in the source code of kioclient and KIO but without success so far (changing the product from `kde-cli-tools` to `frameworks-KIO`, because I believe it’s where the issue lies).

BUT I’ve found something very interesting while playing with `kioclient`:

```
$ kioclient stat file:///home
NAME                  home
SIZE                  4096
FILE_TYPE             0040000
USER                  root
GROUP                 root
DEVICE_ID             66306
INODE                 14942209
MIME_TYPE             inode/directory
ACCESS                0755
MODIFICATION_TIME     Tue Jul 2 23:40:16 2019
ACCESS_TIME           Wed Jul 3 12:41:24 2019
CREATION_TIME         Tue Jul 2 22:47:19 2019

$ kioclient stat file://hostname/home
kioclient: The file or folder smb://hostname/home does not exist.

$ kioclient stat file://localhost/home
kioclient: The file or folder //localhost/home does not exist.

$ kioclient stat file://<MY_HOSTNAME>/home
kioclient: The file or folder //<MY_HOSTNAME>/home does not exist.
```

So it seems that:

– It’s capable of parsing correctly the `file://hostname/path` type URL
– It recognizes localhost and my local hostname
– It does the wrong thing still

It means the fix is probably easy, there’s probably a small logic error somewhere, but finding it may be the hard part.
Comment 3 Munzir Taha 2024-09-25 22:29:21 UTC
I found this after I filed this https://github.com/wez/wezterm/issues/6192