X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/78e34fbdc255fd3f71f5b43ce1acd1fa0678e1ce..ce4855ecb086d17b8a5e725bb56235b370480f71:/IkiWiki/Plugin/filecheck.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm index 6f71be301..27f764e3b 100644 --- a/IkiWiki/Plugin/filecheck.pm +++ b/IkiWiki/Plugin/filecheck.pm @@ -53,6 +53,7 @@ sub parsesize ($) { #{{{ return $base; } #}}} +# This is provided for other plugins that want to convert back the other way. sub humansize ($) { #{{{ my $size=shift; @@ -68,7 +69,7 @@ package IkiWiki::PageSpec; sub match_maxsize ($$;@) { #{{{ my $page=shift; - my $maxsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)}; + my $maxsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)}; if ($@) { return IkiWiki::FailReason->new("unable to parse maxsize (or number too large)"); } @@ -89,7 +90,7 @@ sub match_maxsize ($$;@) { #{{{ sub match_minsize ($$;@) { #{{{ my $page=shift; - my $minsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)}; + my $minsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)}; if ($@) { return IkiWiki::FailReason->new("unable to parse minsize (or number too large)"); } @@ -126,7 +127,10 @@ sub match_mimetype ($$;@) { #{{{ } my $mimetype=File::MimeInfo::Magic::magic($file); if (! defined $mimetype) { - $mimetype="unknown"; + $mimetype=File::MimeInfo::Magic::default($file); + if (! defined $mimetype) { + $mimetype="unknown"; + } } my $regexp=IkiWiki::glob2re($wanted);