X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ef08b8eceac73db5a725d6b6e37509666e7d1047..50ac3aa79c28b517af71ef876b7b60146365a3d6:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index a4657a311..443c70447 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -151,7 +151,9 @@ sub loadplugins () { #{{{ unshift @INC, possibly_foolish_untaint($config{libdir}); } - loadplugin($_) foreach @{$config{plugin}}; + foreach my $plugin (@{$config{plugin}}) { + loadplugin($plugin); + } run_hooks(getopt => sub { shift->() }); if (grep /^-/, @ARGV) { @@ -332,6 +334,10 @@ sub readfile ($;$$) { #{{{ binmode($in) if ($binary); return \*$in if $wantfd; my $ret=<$in>; + # check for invalid utf-8, and toss it back to avoid crashes + if (! utf8::valid($ret)) { + $ret=encode_utf8($ret); + } close $in || error("failed to read $file: $!"); return $ret; } #}}} @@ -562,7 +568,7 @@ sub urlto ($$;$) { #{{{ } if ($absolute) { - return $config{url}.beautify_urlpath("/".$to); + return $config{url}.beautify_url("/".$to); } my $link = abs2rel($to, dirname(htmlpage($from))); @@ -725,7 +731,7 @@ sub preprocess ($$$;$$) { #{{{ my $params=shift; $params="" if ! defined $params; - f (length $escape) { + if (length $escape) { return "[[$prefix$command $params]]"; } elsif (exists $hooks{preprocess}{$command}) {