Bug 501811

Summary: "Copy to clipboard" entry enters unusable data into Klipper.
Product: [Plasma] plasma-browser-integration Reporter: Roke Julian Lockhart Beedell <4wy78uwh>
Component: FirefoxAssignee: Kai Uwe Broulik <kde>
Status: CONFIRMED ---    
Severity: normal CC: f-kde, krammer
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
URL: https://discuss.kde.org/t/unable-to-copy-uri-in-native-browser-share-menu-why/31765/3#:~:text=the%20info%20@rokejulianlockhart-,I%20did%20some%20testing%20myself%20and%20can%20confirm%20with%20Firefox%20and%20Chrome%20natively.,-Didn%E2%80%99t%20work%20at&text=even%20come%20up.-,Which%20leads%20me%20to%20an%20educated%20guess%20that%20this%20might%20be%20functionality%20provided%20by%20the%20Plasma%20Browser%20Integration%20plugin/extension.,-I%20think%20that&text=KDE%20bugzilla%20%E2%80%9Cproduct%E2%80%9D%20is%20plasma%2Dbrowser%2Dintegration
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: A Screenshot of the Data, as Rendered inside Klipper's GUI

Description Roke Julian Lockhart Beedell 2025-03-21 00:28:23 UTC
Created attachment 179620 [details]
A Screenshot of the Data, as Rendered inside Klipper's GUI

SUMMARY

Plasma Integration's "Copy to clipboard" entry enters unusable data into Klipper.

STEPS TO REPRODUCE

1. Visit https://mdn.github.io/dom-examples/web-share/.
2. Select "Share MDN!"
3. Select "Copy to clipboard".
4. Invoke Klipper, and/or attempt to paste.

OBSERVED RESULT

Klipper appears to contain binary data which cannot be pasted into any text entry area.

EXPECTED RESULT

Klipper should contain a UTF-8 URI.

SOFTWARE/OS VERSIONS

> Operating System: Fedora Linux 41  
> KDE Plasma Version: 6.3.3  
> KDE Frameworks Version: 6.12.0  
> Qt Version: 6.8.2  
> Kernel Version: 6.13.7-200.fc41.x86_64 (64-bit)  
> Graphics Platform: Wayland  

ADDITIONAL INFORMATION

Originally confirmed at https://discuss.kde.org/t/unable-to-copy-uri-in-native-browser-share-menu-why/31765/4?u=rokejulianlockhart.
Comment 1 Roke Julian Lockhart Beedell 2025-03-21 00:37:57 UTC
(In reply to Roke Julian Lockhart Beedell from comment #0)
> SOFTWARE/OS VERSIONS

https://addons.mozilla.org/firefox/downloads/file/4298512/plasma_integration-1.9.1.xpi
Comment 2 Kevin Krammer 2025-03-21 08:47:56 UTC
Since I confirmed in the Discuss thread, here are my versions:

Operating System: KDE neon 6.3
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.11.0-19-generic (64-bit)
Graphics Platform: X11

Firefox extension 1.9.1
Chrome extension 2.0

Both browsers are native packages
Comment 3 Kai Uwe Broulik 2025-03-21 09:19:12 UTC
Can confirm.

So this issue happens under X11 as well? Then it’s not what I thought. Under Qt Wayland a URL isn’t implicitly added as text to the clipboard whereas Qt XCB does.
Comment 4 Bug Janitor Service 2025-03-21 09:43:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/purpose/-/merge_requests/129
Comment 5 Kevin Krammer 2025-03-21 10:03:26 UTC
(In reply to Kai Uwe Broulik from comment #3)
> Can confirm.
> 
> So this issue happens under X11 as well? Then it’s not what I thought. Under
> Qt Wayland a URL isn’t implicitly added as text to the clipboard whereas Qt
> XCB does.

Behavior on X11: entry in Klipper is neither text nor URL but looks like broken images.
Pasting (e.g. into KWrite) results in

> https://developer.mozilla.org/
> Learn web development on MDN!
Comment 6 Kai Uwe Broulik 2025-03-21 16:00:12 UTC
Git commit 04dcb61e1d80149116e8d45055abfcd1248204c7 by Kai Uwe Broulik.
Committed on 21/03/2025 at 15:55.
Pushed by broulik into branch 'master'.

Clipboard: Set clipboard text, too, if applicable

Purpose has no proper API contract for sending just text, it's all sent
as part of "urls".

Try to guess what is an URL (we want to be tolerant in the parser since
we don't really know how strict the input will be) and only set that as URL
and also set everything as text.

M  +19   -11   src/plugins/clipboard/clipboardplugin.cpp

https://invent.kde.org/frameworks/purpose/-/commit/04dcb61e1d80149116e8d45055abfcd1248204c7