Bug 441021 - Drag-n-drop for a URL onto .desktop icon opens mangled URL
Summary: Drag-n-drop for a URL onto .desktop icon opens mangled URL
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.22.4
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-15 23:07 UTC by Andrei Rybak
Modified: 2021-08-17 18:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of "kioexec Copying" notification (33.48 KB, image/png)
2021-08-15 23:07 UTC, Andrei Rybak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Rybak 2021-08-15 23:07:59 UTC
Created attachment 140758 [details]
Screenshot of "kioexec Copying" notification

SUMMARY
When drugging an URL onto a .desktop icon of a browser, the URL is mangled and thus a wrong page is opened in the browser.

STEPS TO REPRODUCE
1. Open https://pointieststick.com/2021/08/13/this-week-in-kde-bugfixes-and-ui-improvements-galore/ (or any other website -- using this just as an example) in Firefox
2. Mouse down and drag the "Get involved" link
3. Drop it onto a Chromium.desktop icon on the desktop

OBSERVED RESULT
* A "kioexec Copying" notification is shown (see the screenshot)
* A mangled file:// URL is opened in Chromium: file:///home/andrei/.cache/kioexec/krun/195644_0/Get_Involved

EXPECTED RESULT
URL https://community.kde.org/Get_Involved is opened in Chromium

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-25-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

ADDITIONAL INFORMATION
* This is extremely useful when trying to open a URL in a different browser.
* The video attached at https://bugs.kde.org/show_bug.cgi?id=420131 shows that it used to work in 5.16.5 (albeit intermittently).
Comment 1 Andrei Rybak 2021-08-15 23:10:12 UTC
Also, per comments in https://bugs.kde.org/show_bug.cgi?id=420131 this used to work in 5.19.5.
Comment 2 Nate Graham 2021-08-16 18:53:46 UTC
Hello Andrei! Works for me when dragging that link from the page in Firefox onto:
- A Chromium icon pinned on the task manager
- A Chromium icon on the desktop as a .desktop file

If I drag it onto a Chromium icon on the desktop that's a widget, it hangs forever though.

In no circumstances do I see a kioexec notification.

Can you confirm whether or not dragging the link onto a Chromium icon pinned to your Task Manager works, or is that broken in the same way, or is it broken in a different way?
Comment 3 Andrei Rybak 2021-08-17 18:35:45 UTC
@Nate, both the pinned task manager icon and a _differently created_ desktop icon work. By "differently created" I mean created via "Right click in Application Launcher > + Add to Desktop".

I didn't realize that the contents of .desktop file would matter that much. However, it apparently matters for this use case. The bug as described above only reproduces with a .desktop file I've created myself in a text editor. The whole contents of the file are:

    #!/usr/bin/env xdg-open
    [Desktop Entry]
    Exec=/snap/bin/chromium
    Terminal=false
    Type=Application
    Icon=/snap/chromium/current/chromium.png

It is a bare minimum of what's needed for an otherwise working .desktop icon. The icon created via Application Launcher is actually a symlink to /var/lib/snapd/desktop/applications/chromium_chromium.desktop, which has 296 lines. I'm trying to figure out which of these are needed for the icon to behave differently on drag-n-drop of URLs (drag-n-drop of files works fine with the bare minimum .desktop file).
Comment 4 Andrei Rybak 2021-08-17 18:38:52 UTC
Figured out what was missing: "%U" at the end of the "Exec" value:

    #!/usr/bin/env xdg-open
    [Desktop Entry]
    Exec=/snap/bin/chromium %U
    Terminal=false
    Type=Application
    Icon=/snap/chromium/current/chromium.png

Now my icon works. Sorry for the noise.
Comment 5 Nate Graham 2021-08-17 18:49:51 UTC
Yup, that'll do it. The "%U" is needed for letting the app handle URLs.