Bug 399608

Summary: Notifications in kde truncate after '<' character in body
Product: [Frameworks and Libraries] frameworks-knotifications Reporter: forneus48
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED INTENTIONAL    
Severity: minor CC: kdelibs-bugs, nate, thomas.surrel
Priority: NOR    
Version: 5.49.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot of the notification producded

Description forneus48 2018-10-10 12:35:47 UTC
Created attachment 115536 [details]
Screenshot of the notification producded

SUMMARY
Notifications in kde truncate after '<' character in body. Using opensuse tumbleweed 20180915 kde.

STEPS TO REPRODUCE
1. install libnotify-tools
2. in konsole run notify-send 'while (1<2)' 'while(1<2)'

OBSERVED RESULT
in the notification first message is shown correctly while second is truncated before '<'. In this: notify-send [OPTIONS] <summary> [body] the body part gets truncated.
Notification:
while(1<2)
while(1

EXPECTED RESULT
Both parts show complete message, the summary and body.
Notification:
while(1<2)
while(1<2)

SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Christoph Feck 2018-10-10 14:31:47 UTC
Plasma expects rich text for the body, please try quoting angle brackets using &lt; &gt;
Comment 2 Nate Graham 2018-10-10 17:25:19 UTC
Christoph, is this RESOLVED INTENTIONAL then?
Comment 3 forneus48 2018-10-10 17:39:45 UTC
(In reply to Christoph Feck from comment #1)
> Plasma expects rich text for the body, please try quoting angle brackets
> using &lt; &gt;

Well, the problem is this erroneous notification is sent by clementine for the music album because of the '<' in the name.
I thought the behavior would be same for both the <summary> and the [body].

If this is expected, I'll take up the issue with clementine developers.
Thanks.
Comment 4 Christoph Feck 2018-10-10 21:34:45 UTC
I am not sure if this is intentional. Is 'libnotify' using some XDG standard for notifications? If there is a standard, and it forbids rich text, then Plasma notifications should have a way to show plain notifications, without any character substitutions.
Comment 5 Christoph Feck 2018-10-10 21:38:06 UTC
To answer my own question: According to https://wiki.archlinux.org/index.php/Desktop_notifications libnotify follows the Notification Spec at https://developer.gnome.org/notification-spec/ which says the body may contain simple XML based Markup <b> <i> etc.
Comment 6 Nate Graham 2018-10-10 21:42:22 UTC
So yes, to answer your question forneus48, you should contact the Clementine developers and tell them to properly escape their strings.
Comment 7 Christoph Feck 2018-10-10 22:26:12 UTC
I don't have libnotify installed, but using kdialog I could confirm that Plasma properly substitutes XML entities.

kdialog --passivepopup "Hello <b>&quot;Plasma &amp; Qt&quot;</b>" 1
kdialog --passivepopup "while (1<2)" 1 --icon dialog-error
kdialog --passivepopup "while (1&lt;2)" 1 --icon dialog-information

First line demonstrates XML markup, second line truncates, third line works.