Bug 437960 - History truncates files/folders names which contain # or ? characters
Summary: History truncates files/folders names which contain # or ? characters
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Launcher (Kickoff) widget (other bugs)
Version First Reported In: 5.21.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-01 16:51 UTC by medin
Modified: 2025-06-05 19:46 UTC (History)
3 users (show)

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


Attachments
File/folder name truncated (2.44 MB, video/mp4)
2021-06-08 21:46 UTC, medin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description medin 2021-06-01 16:51:42 UTC
If you open a file/folder which has # or ? in its name, then the name will be truncated and added wrongly to History.

Operating System: Manjaro Linux
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Kernel Version: 5.4.118-1-MANJARO
OS Type: 64-bit
Graphics Platform: X11
Comment 1 Nate Graham 2021-06-08 21:31:31 UTC
Can you show a screenshot?
Comment 2 medin 2021-06-08 21:46:05 UTC
Created attachment 139119 [details]
File/folder name truncated

The same happens for file and folder names.
Comment 3 Nate Graham 2021-06-09 14:45:19 UTC
Can confirm. How bizarre.
Comment 4 cwo 2025-06-05 18:19:33 UTC
Git commit c6c0a68416b5042032853a6f673bddbe475567b7 by Christoph Wolk.
Committed on 05/06/2025 at 17:45.
Pushed by cwo into branch 'master'.

applets/kicker: fix filenames containing # in history

Kicker takes the resource name as provided by PlasmaActivities.Stats and
interprets it as an URL, setting the 'file' url scheme if necessary.
This fails when the filenames contain a '#' character, as QUrl will
interpret them as url fragments if not percent-encoded (which they are
not for local files, but are for remote urls). This makes display and
opening of such files fail in both Kicker and Kickoff.

Instead, we test whether it's an absolute path (the local history
entries are) and if so, use QUrl.fromLocalFile to get the correct url.
This is also what PlasmaActivities.Stats does in ResultSet (which is
what the Task Manager uses, so everything works there already, but we
want a real model here).
Related: bug 419449
FIXED-IN: 6.4.0

M  +5    -3    applets/kicker/recentusagemodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/c6c0a68416b5042032853a6f673bddbe475567b7
Comment 5 cwo 2025-06-05 19:46:48 UTC
Git commit ab55c53e37814da5aadf9bf29dd5cae7a783ef6e by Christoph Wolk.
Committed on 05/06/2025 at 18:33.
Pushed by cwo into branch 'Plasma/6.4'.

applets/kicker: fix filenames containing # in history

Kicker takes the resource name as provided by PlasmaActivities.Stats and
interprets it as an URL, setting the 'file' url scheme if necessary.
This fails when the filenames contain a '#' character, as QUrl will
interpret them as url fragments if not percent-encoded (which they are
not for local files, but are for remote urls). This makes display and
opening of such files fail in both Kicker and Kickoff.

Instead, we test whether it's an absolute path (the local history
entries are) and if so, use QUrl.fromLocalFile to get the correct url.
This is also what PlasmaActivities.Stats does in ResultSet (which is
what the Task Manager uses, so everything works there already, but we
want a real model here).
Related: bug 419449
FIXED-IN: 6.4.0


(cherry picked from commit c6c0a68416b5042032853a6f673bddbe475567b7)

Co-authored-by: Christoph Wolk <cwo.kde@posteo.net>

M  +5    -3    applets/kicker/recentusagemodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/ab55c53e37814da5aadf9bf29dd5cae7a783ef6e