Fix man module opts URL escaping
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled

This commit is contained in:
Ilia Ross
2026-05-15 12:58:12 +02:00
parent 8159fad28f
commit aa87f85d4a
2 changed files with 7 additions and 5 deletions

View File

@@ -213,8 +213,9 @@ if ($section{'man'}) {
next if (!$all && $in{'and'} || !$any);
push(@rv, [ $text{'search_man'},
"view_man.cgi?page=$pp[0]&sec=$3&opts=".
$opts{'man'}, "$pp[0] ($sect)",
"view_man.cgi?page=".&urlize($pp[0]).
"&sec=".&urlize($sect)."&opts=".
&urlize($opts{'man'}), "$pp[0] ($sect)",
&html_escape($desc),
$exact ? 4 : 3 ]);
}

View File

@@ -69,10 +69,12 @@ else {
$cmd = "cat";
}
$qout = quotemeta($out);
$uopts = &urlize($in{'opts'});
$manout = &backquote_command("$config{'man2html_path'} -v 2>&1", 1);
if ($manout =~ /Version:\s+([0-9\.]+)/i && $1 >= 3) {
# New version uses a different syntax!
$cmd .= " $qout | nroff -mman | $config{'man2html_path'} --cgiurl ".quotemeta("view_man.cgi?page=\\\${title}&sec=\\\${section}&opts=$in{'opts'}")." --bare";
$cgiurl = "view_man.cgi?page=\${title}&sec=\${section}&opts=$uopts";
$cmd .= " $qout | nroff -mman | $config{'man2html_path'} --cgiurl ".quotemeta($cgiurl)." --bare";
$out = &backquote_command("$cmd 2>&1", 1);
}
else {
@@ -82,8 +84,7 @@ else {
$out =~ s/^.*Content-type:.*\n//i;
$out =~ s/http:\/\///ig;
$out =~ s/\?/\?sec=/ig;
$eopts = &html_escape($in{'opts'});
$out =~ s/\+/&opts=$eopts&page=/ig;
$out =~ s/\+/&opts=$uopts&page=/ig;
$out =~ s/<HTML>.*<BODY>//isg;
$out =~ s/<\/HTML>//ig;
$out =~ s/<\/BODY>//ig;