Commit d27defbd authored by Igor Kushnir's avatar Igor Kushnir Committed by Jonathan Marten
Browse files

man: remove the section suffix from page names in listDir()

After recent major changes to man's listDir() (starting at
223de3ec and ending with
1d752c04) man page names acquired
section suffixes in parentheses. For example, "aio.h" became
"aio.h (0p)". This page name format change broke URLs formed by joining
a section URL and a page name, e.g. "man:/(7)" + '/' + "bootup (7)".
The `xdg-open "man:/(7)/bootup (7)"` command opens this broken link in
KHelpCenter, which displays the "Manual Page Viewer Error" page.
The added section suffixes also break displaying man pages in KDevelop's
Man Pages documentation plugin.

Revert this breaking change by removing the section suffix rather than
reformatting it into parentheses.

(cherry picked from commit d676e808)

BUG: 452920
FIXED-IN: 22.04.02
parent 0a836b1f
......@@ -1369,9 +1369,9 @@ void MANProtocol::listDir(const QUrl &url)
// Remove any preceding pathname components, just leave the base name
int pos = name.lastIndexOf('/');
if (pos>0) name = name.mid(pos+1);
// Reformat the section suffix into the standard form
// Remove the section suffix
pos = name.lastIndexOf('.');
if (pos>0) name = name.left(pos)+" ("+name.mid(pos+1)+')';
if (pos>0) name.truncate(pos);
uds_entry.clear();
uds_entry.fastInsert(KIO::UDSEntry::UDS_NAME, name);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment