diff options
author | http://kerravonsen.dreamwidth.org/ <http://kerravonsen.dreamwidth.org/@web> | 2010-03-25 03:35:14 +0000 |
---|---|---|
committer | Joey Hess <joey@finch.kitenet.net> | 2010-03-25 03:35:14 +0000 |
commit | dc966032129e07b9a6002a97bc9e6b86c712b4d2 (patch) | |
tree | d80ed81a135900c388f048dfbd0b6b7b296f09d2 /doc/bugs | |
parent | 81cd30690024db1fc0b300e3a09504f1c613be21 (diff) |
bug and fix
Diffstat (limited to 'doc/bugs')
-rw-r--r-- | doc/bugs/filecheck_failing_to_find_files.mdwn | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/bugs/filecheck_failing_to_find_files.mdwn b/doc/bugs/filecheck_failing_to_find_files.mdwn new file mode 100644 index 000000000..95ea5c763 --- /dev/null +++ b/doc/bugs/filecheck_failing_to_find_files.mdwn @@ -0,0 +1,23 @@ +Using the attachment plugin, when filecheck was checking the mime-type of the attachment before allowing the attachment to be removed, it was returning with an error saying that the mime-type of the file was "unknown" (when the mime-type definitely was known!) + +It turns out that the filecheck plugin couldn't find the file, because it was merely using the $pagesources hash, rather than finding the absolute path of the file in question. + +The following patch fixes the problem: + + diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm + index 01d4909..1cec0cf 100644 + --- a/IkiWiki/Plugin/filecheck.pm + +++ b/IkiWiki/Plugin/filecheck.pm + @@ -118,6 +118,10 @@ sub match_mimetype ($$;@) { + if (! defined $file) { + return IkiWiki::ErrorReason->new("no file specified"); + } + + if (! -e $file) { + + # get the absolute path of the file if you can't find it + + $file = IkiWiki::srcfile($file); + + } + + # Use ::magic to get the mime type, the idea is to only trust + # data obtained by examining the actual file contents. + +[[!tag patch]] |