Bug 461756

Summary: kde-open should support opening file://hostname/path/to/file
Product: [Frameworks and Libraries] frameworks-kio Reporter: ppwwyyxx <ppwwyyxxc>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: aria, kde, kdelibs-bugs-null, KMonsefi, munzirtaha, nate, nicolas.fella, zhanibek.adilbekov
Priority: NOR    
Version First Reported In: 5.109.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description ppwwyyxx 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