X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/64a8c828b8cfa342118dd6e28b9dff43d83c6311..f7303db5a194bff0e0c621efedc320cf9997d35e:/IkiWiki/Plugin/meta.pm?ds=sidebyside
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 849a13e37..74b630afc 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -18,7 +18,8 @@ sub needsbuild (@) { #{{{
my $needsbuild=shift;
foreach my $page (keys %pagestate) {
if (exists $pagestate{$page}{meta}) {
- if (grep { $_ eq $pagesources{$page} } @$needsbuild) {
+ if (exists $pagesources{$page} &&
+ grep { $_ eq $pagesources{$page} } @$needsbuild) {
# remove state, it will be re-added
# if the preprocessor directive is still
# there during the rebuild
@@ -37,6 +38,17 @@ sub scrub ($) { #{{{
}
} #}}}
+sub safeurl ($) { #{{{
+ my $url=shift;
+ if (exists $IkiWiki::Plugin::htmlscrubber::{safe_url_regexp} &&
+ defined $IkiWiki::Plugin::htmlscrubber::safe_url_regexp) {
+ return $url=~/$IkiWiki::Plugin::htmlscrubber::safe_url_regexp/;
+ }
+ else {
+ return 1;
+ }
+} #}}}
+
sub htmlize ($$$) { #{{{
my $page = shift;
my $destpage = shift;
@@ -87,7 +99,7 @@ sub preprocess (@) { #{{{
# fallthorough
}
elsif ($key eq 'authorurl') {
- $pagestate{$page}{meta}{authorurl}=$value;
+ $pagestate{$page}{meta}{authorurl}=$value if safeurl($value);
# fallthrough
}
@@ -105,8 +117,10 @@ sub preprocess (@) { #{{{
}
}
elsif ($key eq 'permalink') {
- $pagestate{$page}{meta}{permalink}=$value;
- push @{$metaheaders{$page}}, scrub('');
+ if (safeurl($value)) {
+ $pagestate{$page}{meta}{permalink}=$value;
+ push @{$metaheaders{$page}}, scrub('');
+ }
}
elsif ($key eq 'stylesheet') {
my $rel=exists $params{rel} ? $params{rel} : "alternate stylesheet";
@@ -123,12 +137,14 @@ sub preprocess (@) { #{{{
"\" type=\"text/css\" />";
}
elsif ($key eq 'openid') {
- if (exists $params{server}) {
+ if (exists $params{server} && safeurl($params{server})) {
push @{$metaheaders{$page}}, '';
}
- push @{$metaheaders{$page}}, '';
+ if (safeurl($value)) {
+ push @{$metaheaders{$page}}, '';
+ }
}
elsif ($key eq 'redir') {
return "" if $page ne $destpage;