]> git.proxmox.com Git - pve-docs.git/commitdiff
asciidoc-pve: disallow certain characters in onlineHelp keys
authorStefan Sterz <s.sterz@proxmox.com>
Mon, 14 Nov 2022 11:38:27 +0000 (12:38 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 14 Nov 2022 13:27:16 +0000 (14:27 +0100)
this removes the lazily evaluated part of the regex used to detect
`onlineHelp` keys in order to match them with asciidoc anchors in the
documentation. it uses a pattern that excludes curly braces, brackets
and quotations instead. this allows for greedy matching and also
removes an issue where keys that are set via CBind were included
incorrectly. the script would try to find an anchor name that was
equivalent to the CBind placeholder, which would fail.

since brackets, curly braces and quotation marks aren't allowed in
asciidoc anchors anyway, excluding them like this should be safe.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
asciidoc-pve.in

index d638a382c85d4e792e862c8cfabd10f911370161..49e54bddf0aef7edcff27c7d830150000519e170 100644 (file)
@@ -465,7 +465,7 @@ sub scan_extjs_file {
     debug("scan-extjs $filename");
 
     while(defined(my $line = <$fh>)) {
-       if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
+       if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]/) {
            my $blockid = $1;
            my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
            die "undefined blockid '$blockid' ($filename, line $.)\n"