diff options
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/progress.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm index e459637b8..6cb21a916 100644 --- a/IkiWiki/Plugin/progress.pm +++ b/IkiWiki/Plugin/progress.pm @@ -5,7 +5,7 @@ use warnings; use strict; use IkiWiki 2.00; -my $percentage_pattern = qr/[0-9]+\%/; # pattern to validate percentages +my $percentage_pattern = qr/[0-9]+\%?/; # pattern to validate percentages sub import { #{{{ hook(type => "getsetup", id => "progress", call => \&getsetup); @@ -29,6 +29,12 @@ sub preprocess (@) { #{{{ if (defined $params{percent}) { $fill = $params{percent}; ($fill) = $fill =~ m/($percentage_pattern)/; # fill is untainted now + if (! defined $fill || ! length $fill || $fill > 100 || $fill < 0) { + error("illegal percent value $params{percent}"); + } + elsif ($fill !~ /%$/) { + $fill.="%"; + } } elsif (defined $params{totalpages} and defined $params{donepages}) { add_depends($params{page}, $params{totalpages}); |