Bug 446869 - Dolphin handles broken symlinks in an unexpected way (try to open link as file)
Summary: Dolphin handles broken symlinks in an unexpected way (try to open link as file)
Status: REPORTED
Alias: None
Product: dolphin
Classification: Applications
Component: general (other bugs)
Version First Reported In: 21.12.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-12 08:59 UTC by Kishore Gopalakrishnan
Modified: 2025-06-25 12:11 UTC (History)
4 users (show)

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


Attachments
Error appearing on Dolphin (32.68 KB, image/png)
2025-01-07 14:01 UTC, Dimitri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2021-12-12 08:59:29 UTC
SUMMARY
When the user tries to open a broken symlink, Dolphin asks the user to choose an application, instead of first raising some sort of error or warning.

STEPS TO REPRODUCE
1. Run the following command in any directory: ln -s /location_that_does_not_exist brokenlink 
2. Navigate to that directory in Dolphin and click on the link to open it

OBSERVED RESULTS
Dolphin directly asks the user which application should be used to open the file.

EXPECTED RESULTS
Dolphin should first warn the user that the symlink is broken.
Other programs detect this correctly, e.g. running `file brokenlink` in the terminal gives the following output:
brokenlink: broken symbolic link to /location_that_does_not_exist

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.15.7-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
Memory: 21.5 GiB of RAM
Graphics Processor: AMD Radeon Vega 8 Graphics

ADDITIONAL INFORMATION
'Right-click > Show Target' correctly complains that the destination is not accessible.
Comment 1 Dimitri 2025-01-07 14:01:49 UTC
Created attachment 177168 [details]
Error appearing on Dolphin

We are now getting an error message, both when opening in Dolphin and when opening on Desktop.
The error message is "WorkingDirectory= expects an absolute path or '~' " which is not a good message. The broken given path is an absolute path. It should instead say something like "The given path is invalid." and this message should be translated by the OS to the language of the user (not the case here).

Also, when trying to open in Dolphin, I see that KWrite try to open the file and close itself (without a window to open, it just appear and disappear in the taskbar). So there is definitely something else than the content of the error to fix.
Comment 2 Lassi Väätämöinen 2025-06-25 12:11:51 UTC
Similar error occurs if your location is in URL format, copied using like so:

1. open right-click context menu on a file
2. Copy location: file:///home/myuser/Documents/test.txt
3. Go to another directory
4. Right-click -> Create New -> Link to file or directory -> paste file path from clipboard (file:///home/myuser/Documents/test.txt)
5. Check that link name is prefilled OK, close dialog
6. Click on created link: test.txt

Observed:
"WorkingDirectory= expects an absolute path or '~' "

Expected:
File opens in editor (or other assigned app)

ADDTIONAL INFO:
removing the file:// prefix from the link location fixes it.

Dolphin should remove the prefix automatically, as the original file path was obtained by right-clicking and copying the path in Dolphin. Currently the behavior is 'asymmetrical'.