]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
some issues joeyh reported on IRC
[ikiwiki.git] / IkiWiki.pm
index d949566d834fb1cfcc053bd48ae91398f2571e80..2ad2f792d144b8d52c2d8b4a978d365586ed76a2 100644 (file)
@@ -277,13 +277,20 @@ sub getsetup () { #{{{
        },
        umask => {
                type => "integer",
-               description => "",
                example => "022",
                description => "force ikiwiki to use a particular umask",
                advanced => 1,
                safe => 0, # paranoia
                rebuild => 0,
        },
+       wrappergroup => {
+               type => "string",
+               example => "ikiwiki",
+               description => "group for wrappers to run in",
+               advanced => 1,
+               safe => 0, # paranoia
+               rebuild => 0,
+       },
        libdir => {
                type => "string",
                default => "",
@@ -721,6 +728,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;
 } #}}}
@@ -938,9 +949,9 @@ sub beautify_urlpath ($) { #{{{
                $url =~ s!/index.$config{htmlext}$!/!;
        }
 
-       # Ensure url is not an empty link, and
-       # if it's relative, make that explicit to avoid colon confusion.
-       if ($url !~ /^\//) {
+       # Ensure url is not an empty link, and if necessary,
+       # add ./ to avoid colon confusion.
+       if ($url !~ /^\// && $url !~ /^\.\.\//) {
                $url="./$url";
        }
 
@@ -1295,6 +1306,7 @@ sub lockwiki () { #{{{
 } #}}}
 
 sub unlockwiki () { #{{{
+       POSIX::close($ENV{IKIWIKI_CGILOCK_FD}) if exists $ENV{IKIWIKI_CGILOCK_FD};
        return close($wikilock) if $wikilock;
        return;
 } #}}}