Bug 390375

Summary: Klipper notifications visually broken since plasma 5.12
Product: [Plasma] plasmashell Reporter: Till Schäfer <till2.schaefer>
Component: NotificationsAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED FIXED    
Severity: normal CC: achilleas.k, kde, plasma-bugs
Priority: NOR    
Version: 5.12.0   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.12.5
Sentry Crash Report:
Attachments: screenshot of visually broken notification

Description Till Schäfer 2018-02-13 13:38:47 UTC
Created attachment 110607 [details]
screenshot of visually broken notification

After upgrading to plasma 5.12, the klipper notifications, which are issued while changing the clipboard content to the next/previous history item are visually broken. It seems that the newlines and the horizontal alignment are gone and all text is just written in one line. 

See the attached screenshot.
Comment 1 David Edmundson 2018-02-14 01:05:50 UTC
Klipper is sending a table as text. See Klipper::cycleText

They aren't HTML tags that were ever permissable in the notification specification. Klipper is in the wrong.

Since 5.12 we filter to only the tags that are allowed.

From a security POV, we could re-allow the table with the attribute filtering we now have and it'd be safe. But I don't know if I want to.
Comment 2 Till Schäfer 2018-02-21 13:42:04 UTC
do we have a classical "diffusion of responsibility" situation here? :-)

If the table does not introduce any security holes, are there any reasons to not allow it? Maybe the notification specification should be updated accordingly then...

Nevertheless, either way should be OK, i.g., fixing Klipper or Plasma, from my POV.
Comment 3 Till Schäfer 2018-03-27 18:10:22 UTC
Can you point me to a notification specification for KDE? I will try to fix that bug myself and create a phabricator ticket. 

I only found this document [1], but it seems rather outdated. The gnome documentation [2] only mentions markdown that modifies the font appearance, creates links or embeds an image. However, there is nothing to actually formal the layout. So it would be nice to get some hint, if there are other possibilities to layout a notification. 

[1] https://community.kde.org/Plasma/Notifications
[2] https://developer.gnome.org/notification-spec/
Comment 4 David Edmundson 2018-03-27 18:22:10 UTC
We tend to follow [2]

>However, there is nothing to actually formal the layout

Yes, there's nothing, which is why klipper's attempts to use something doesn't work and gets stripped out.

If we want to add support in our notifications just modify notificationsanitizer.cpp:49   allowedTags = {..} to include the 3 releavant table ones
But then we're going off spec.
Comment 5 Till Schäfer 2018-03-27 19:07:00 UTC
created phabricator ticket [1] and added you as reviewer (if that's alright :-)) 

[1] https://phabricator.kde.org/D11754
Comment 6 Kai Uwe Broulik 2018-03-28 10:12:09 UTC
Git commit 896950a819ea76800007cad7393adacac7f9bf20 by Kai Uwe Broulik, on behalf of Till Schäfer.
Committed on 28/03/2018 at 10:11.
Pushed by broulik into branch 'Plasma/5.12'.

fix: Klipper notifications visually broken since plasma 5.12
FIXED-IN: 5.12.5

Differential Revision: https://phabricator.kde.org/D11754

M  +1    -1    dataengines/notifications/notificationsanitizer.cpp
M  +3    -1    dataengines/notifications/notificationsanitizer.h

https://commits.kde.org/plasma-workspace/896950a819ea76800007cad7393adacac7f9bf20