summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-05-07 00:22:05 -0400
committerJoey Hess <joey@kitenet.net>2010-05-07 00:22:05 -0400
commit1678604fe36e2a1397e13aa1b36e7807be8f2bc6 (patch)
tree116a255fa3fa8e713cc472344af4fac1be6c8b3b /IkiWiki/Plugin
parent300001184ea60895de9a63537951c41b21486f11 (diff)
avoid redir loop when going to an internal page that has no permalink
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/goto.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm
index 03bd682b3..669211691 100644
--- a/IkiWiki/Plugin/goto.pm
+++ b/IkiWiki/Plugin/goto.pm
@@ -41,14 +41,15 @@ sub cgi_goto ($;$) {
IkiWiki::loadindex();
- # If the page is internal (like a comment), see if it has a
- # permalink. Comments do.
- if (IkiWiki::isinternal($page) &&
- defined $pagestate{$page}{meta}{permalink}) {
- IkiWiki::redirect($q, $pagestate{$page}{meta}{permalink});
+ my $link;
+ if (! IkiWiki::isinternal($page)) {
+ $link = bestlink("", $page);
+ }
+ elsif (defined $pagestate{$page}{meta}{permalink}) {
+ # Can only redirect to an internal page if it has a
+ # permalink.
+ IkiWiki::redirect($q, $pagestate{$page}{meta}{permalink});
}
-
- my $link = bestlink("", $page);
if (! length $link) {
IkiWiki::cgi_custom_failure(