filecheck: Fix bug that prevented the pagespecs from matching when not called by attachment plugin.

master
Joey Hess 2010-03-25 14:39:09 -04:00
parent b19fb349f5
commit 3d671ea8c1
3 changed files with 15 additions and 8 deletions

View File

@ -75,9 +75,9 @@ sub match_maxsize ($$;@) {
}
my %params=@_;
my $file=exists $params{file} ? $params{file} : $IkiWiki::pagesources{$page};
my $file=exists $params{file} ? $params{file} : IkiWiki::srcfile($IkiWiki::pagesources{$page});
if (! defined $file) {
return IkiWiki::ErrorReason->new("no file specified");
return IkiWiki::ErrorReason->new("file does not exist");
}
if (-s $file > $maxsize) {
@ -96,9 +96,9 @@ sub match_minsize ($$;@) {
}
my %params=@_;
my $file=exists $params{file} ? $params{file} : $IkiWiki::pagesources{$page};
my $file=exists $params{file} ? $params{file} : IkiWiki::srcfile($IkiWiki::pagesources{$page});
if (! defined $file) {
return IkiWiki::ErrorReason->new("no file specified");
return IkiWiki::ErrorReason->new("file does not exist");
}
if (-s $file < $minsize) {
@ -114,9 +114,9 @@ sub match_mimetype ($$;@) {
my $wanted=shift;
my %params=@_;
my $file=exists $params{file} ? $params{file} : $IkiWiki::pagesources{$page};
my $file=exists $params{file} ? $params{file} : IkiWiki::srcfile($IkiWiki::pagesources{$page});
if (! defined $file) {
return IkiWiki::ErrorReason->new("no file specified");
return IkiWiki::ErrorReason->new("file does not exist");
}
# Use ::magic to get the mime type, the idea is to only trust
@ -147,9 +147,9 @@ sub match_virusfree ($$;@) {
my $wanted=shift;
my %params=@_;
my $file=exists $params{file} ? $params{file} : $IkiWiki::pagesources{$page};
my $file=exists $params{file} ? $params{file} : IkiWiki::srcfile($IkiWiki::pagesources{$page});
if (! defined $file) {
return IkiWiki::ErrorReason->new("no file specified");
return IkiWiki::ErrorReason->new("file does not exist");
}
if (! exists $IkiWiki::config{virus_checker} ||

2
debian/changelog vendored
View File

@ -15,6 +15,8 @@ ikiwiki (3.20100324) UNRELEASED; urgency=low
* Allow wrappers to be built using tcc.
* Add support for setup files written in YAML.
* Add --set-yaml switch for setting more complex config file options.
* filecheck: Fix bug that prevented the pagespecs from matching when
not called by attachment plugin.
-- Joey Hess <joeyh@debian.org> Sat, 13 Mar 2010 14:48:10 -0500

View File

@ -10,6 +10,11 @@ It turns out that the filecheck plugin couldn't find the file, because it was me
>> But if it is given `/path/to/srcdir/foo/bar.gif` instead, then it *can* find the file, and returns the mime-type correctly.
>> --[[KathrynAndersen]]
>>> Ok, so it's not removal specific, can in fact be triggered by using
>>> testpagespec (or really anything besides attachment, which passes
>>> the filename parameter). Nor is it limited to mimetype, all the tests in
>>> filecheck have the problem. [[Fixed|done]] --[[Joey]]
The following patch fixes the problem:
diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm