]> scripts.mit.edu Git - www/ikiwiki.git/commitdiff
po(myurlto): more robust run_by_editpage logic
authorintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 00:14:06 +0000 (01:14 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 00:14:06 +0000 (01:14 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index 77439a3ca1fc1504d6c4f0151ec939711e74f8a6..205066341fc2105b436d7439312729c5dc06e680 100644 (file)
@@ -483,7 +483,9 @@ sub myurlto ($$;$) {
        # avoid, i.e. when po_link_to = negotiated
        if ($config{po_link_to} eq "negotiated") {
                my @caller = caller(1);
-               my $run_by_editpage = ($caller[3] eq "IkiWiki::cgi_editpage");
+               my $run_by_editpage = 0;
+               $run_by_editpage = 1 if (exists $caller[3] && defined $caller[3]
+                                        && $caller[3] eq "IkiWiki::cgi_editpage");
                inject(name => "IkiWiki::beautify_urlpath", call => $origsubs{'beautify_urlpath'})
                        if $run_by_editpage;
                my $res = $origsubs{'urlto'}->($to,$from,$absolute);