Bug 502106 - Notification body omits text after first '<'
Summary: Notification body omits text after first '<'
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 6.3.3
Platform: Gentoo Packages Linux
: HI major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-28 02:45 UTC by snow flurry
Modified: 2025-04-29 23:25 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description snow flurry 2025-03-28 02:45:45 UTC
SUMMARY
Plasma notifications with a body including a '<', either unterminated or with a space, will only present everything leading up to that '<' character.

STEPS TO REPRODUCE
1. Send a desktop notification using something like notify-send. As an example:

    notify-send 'Test' 'i <3 computers'

OBSERVED RESULT
A push notification appears showing

    notify-send
    ---
    Test
    i

Notably, the '<' and following characters are not displayed.

EXPECTED RESULT

The full notification appears. In the above case:

    notify-send
    ---
    Test
    i <3 computers

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo Linux (Kernel 6.13.5-gentoo-dist)
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION

In my testing, this happens with Discord and Firefox, whereas NeoChat is fine. My guess is NeoChat (or KNotifications in general?) is handling the conversion from '<' to "&lt;", whereas other implementations aren't doing that.

Some other test cases:

'1 < 2 && 2 > 3' shows "1"
'<button>this is visible</button> but <button disabled>this isnt</button>' shows "this is visible but"
Comment 1 Bug Janitor Service 2025-03-28 03:33:38 UTC
Thank you for the bug report!

However Plasma 6.2.5 is no longer eligible for support or maintenance from KDE; supported versions are 5.27. (LTS), and 6.3 (non-LTS) or newer. Please upgrade to a supported version as soon as your distribution makes it available to you. Plasma is a fast-moving project, and bugs in one version are often fixed in the next one.

If you need support for Plasma 6.2.5, please contact your distribution, who bears the responsibility of providing support for older releases that are no longer supported by KDE.

If you can reproduce the issue after upgrading to a supported version, feel free to re-open this bug report.
Comment 2 snow flurry 2025-03-28 19:29:43 UTC
This is still occurring on KDE Plasma 6.3.3.

Linux/KDE Plasma: Gentoo Linux (Kernel 6.13.8-gentoo-dist)
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Comment 3 Nate Graham 2025-03-31 18:59:31 UTC
Can reproduce with git master.
Comment 4 Nate Graham 2025-04-25 07:38:15 UTC
Pretty sure this is happening in Notification::Private::sanitize()
Comment 5 Bug Janitor Service 2025-04-25 11:29:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5432
Comment 6 Akseli Lahtinen 2025-04-29 09:11:27 UTC
Git commit b88fe8896241a12a2b95584be82d1c581e786b8b by Akseli Lahtinen.
Committed on 29/04/2025 at 09:11.
Pushed by akselmo into branch 'master'.

Notification: Escape lonely < and > symbols

Since we're sending the text inside html tags, use a regexp
to find out any potential lonely < and > symbols.
Then, escape those.

Also adds autotests for this case.

M  +5    -2    libnotificationmanager/autotests/notifications_test.cpp
M  +9    -0    libnotificationmanager/notification.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/b88fe8896241a12a2b95584be82d1c581e786b8b
Comment 7 Akseli Lahtinen 2025-04-29 23:24:47 UTC
Git commit 38f3a27c58a1c0a943ad07e941fbe2ece70bdf5a by Akseli Lahtinen.
Committed on 29/04/2025 at 12:23.
Pushed by ngraham into branch 'Plasma/6.3'.

Notification: Escape lonely < and > symbols

Since we're sending the text inside html tags, use a regexp
to find out any potential lonely < and > symbols.
Then, escape those.

Also adds autotests for this case.


(cherry picked from commit b88fe8896241a12a2b95584be82d1c581e786b8b)

95339799 Notification: Escape lonely < and > symbols
bb6f06ad Turn allowedTags into reusable stringList
19ad556b Simplify the allowedTags list
2ae351e5 Simplify regex, update tests

Co-authored-by: Akseli Lahtinen <akselmo@akselmo.dev>

M  +5    -2    libnotificationmanager/autotests/notifications_test.cpp
M  +9    -0    libnotificationmanager/notification.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/38f3a27c58a1c0a943ad07e941fbe2ece70bdf5a