}
}
elsif ($key eq 'redir') {
+ return "" if $destpage ne $page;
my $safe=0;
if ($value !~ /^\w+:\/\//) {
add_depends($page, $value);
if (! length $link) {
return "[[meta ".gettext("redir page not found")."]]";
}
+
+ $value=urlto($link, $page);
+ $safe=1;
+
+ # redir cycle detection
$pagestate{$page}{meta}{redir}=$link;
- if ($pagestate{$link}{meta}{redir}) {
- # TODO: real cycle detection
- return "[[meta ".gettext("redir not allowed to point to a page that contains a redir")."]]";
+ my $at=$page;
+ my %seen;
+ while (exists $pagestate{$at}{meta}{redir}) {
+ if ($seen{$at}) {
+ return "[[meta ".gettext("redir cycle is not allowed")."]]";
+ }
+ $seen{$at}=1;
+ $at=$pagestate{$at}{meta}{redir};
}
- $value=urlto($link, $destpage);
- $safe=1;
}
else {
$value=encode_entities($value);