diff options
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/404.pm | 3 | ||||
-rw-r--r-- | IkiWiki/Plugin/git.pm | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/404.pm b/IkiWiki/Plugin/404.pm index 5550ea7d1..bae9e15d1 100644 --- a/IkiWiki/Plugin/404.pm +++ b/IkiWiki/Plugin/404.pm @@ -67,7 +67,8 @@ sub cgi_page_from_404 ($$$) { sub cgi ($) { my $cgi=shift; - if ($ENV{REDIRECT_STATUS} eq '404') { + if (exists $ENV{REDIRECT_STATUS} && + $ENV{REDIRECT_STATUS} eq '404') { my $page = cgi_page_from_404($ENV{REDIRECT_URL}, $config{url}, $config{usedirs}); IkiWiki::Plugin::goto::cgi_goto($cgi, $page); diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 042c69f5a..b386ab71b 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -136,14 +136,16 @@ sub safe_git (&@) { } # In parent. + # git output is probably utf-8 encoded, but may contain + # other encodings or invalidly encoded stuff. So do not rely + # on the normal utf-8 IO layer, decode it by hand. + binmode($OUT); + my @lines; while (<$OUT>) { + $_=decode_utf8($_, 0); + chomp; - - # check for invalid utf-8, and toss it back to avoid crashes - if (! utf8::valid($_)) { - $_=encode_utf8($_); - } push @lines, $_; } @@ -447,7 +449,7 @@ sub rcs_commit_staged ($$$) { # Set the commit author and email to the web committer. my %env=%ENV; if (defined $user || defined $ipaddr) { - my $u=defined $user ? $user : $ipaddr; + my $u=encode_utf8(defined $user ? $user : $ipaddr); $ENV{GIT_AUTHOR_NAME}=$u; $ENV{GIT_AUTHOR_EMAIL}="$u\@web"; } |