X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/c4d4cad3befbbd444d094cbeb0b6ebba3910a025..8030ecac02a743e930e480650e8c14413f26d9a2:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 6fd112960..d114c9a69 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1455,11 +1455,12 @@ sub filter ($$$) { return $content; } -sub check_canedit ($$$;$) { +sub check_canedit ($$$;$$) { my $page=shift; my $q=shift; my $session=shift; my $nonfatal=shift; + my $nosubs=shift; my $canedit; run_hooks(canedit => sub { @@ -1470,6 +1471,7 @@ sub check_canedit ($$$;$) { $canedit=1; } elsif (ref $ret eq 'CODE') { + error(sprintf(gettext("you are not allowed to change %s"), $page)) if $nosubs && ! $nonfatal; $ret->() unless $nonfatal; $canedit=0; } @@ -2401,14 +2403,17 @@ package IkiWiki::PageSpec; sub derel ($$) { my $path=shift; my $from=shift; - if ($path eq '.') { - $path = $from; - } - if ($path =~ m!^\./!) { - $from=~s#/?[^/]+$## if defined $from; - $path=~s#^\./##; - $path="$from/$path" if defined $from && length $from; + if ($path =~ m!^\.(/|$)!) { + if ($1) { + $from=~s#/?[^/]+$## if defined $from; + $path=~s#^\./##; + $path="$from/$path" if defined $from && length $from; + } + else { + $path = $from; + $path = "" unless defined $path; + } } return $path;