sub import {
hook(type => "cgi", id => 'goto', call => \&cgi);
+ hook(type => "getsetup", id => 'goto', call => \&getsetup);
}
sub getsetup () {
IkiWiki::redirect($q, $pagestate{$page}{meta}{permalink});
}
- if (! length $link) {
+ if (! defined $link || ! length $link) {
IkiWiki::cgi_custom_failure(
$q,
"404 Not Found",
- IkiWiki::misctemplate(gettext("missing page"),
+ IkiWiki::cgitemplate($q, gettext("missing page"),
"<p>".
sprintf(gettext("The page %s does not exist."),
htmllink("", "", $page)).
)
}
else {
- IkiWiki::redirect($q, urlto($link, undef, 1));
+ IkiWiki::redirect($q, urlto($link));
}
exit;