aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-09-01 15:00:15 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-09-01 15:00:15 -0400
commitb7458c48d8a85866fdc7c074b1571e2f623acc2c (patch)
tree654f487b9af89268fa50270aa37095e1e65c9afe
parent000c87f510bee6085030e084041d595146984a26 (diff)
downloadikiwiki-b7458c48d8a85866fdc7c074b1571e2f623acc2c.tar
ikiwiki-b7458c48d8a85866fdc7c074b1571e2f623acc2c.tar.gz
filecheck: Fall back to testing for binary or plain text files if no mime type is detected.
-rw-r--r--IkiWiki/Plugin/filecheck.pm5
-rw-r--r--debian/changelog2
-rw-r--r--doc/plugins/filecheck/discussion.mdwn26
3 files changed, 7 insertions, 26 deletions
diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
index 9c7a8dbb7..27f764e3b 100644
--- a/IkiWiki/Plugin/filecheck.pm
+++ b/IkiWiki/Plugin/filecheck.pm
@@ -127,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);
diff --git a/debian/changelog b/debian/changelog
index 9f7821551..85c550c28 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ ikiwiki (2.63) UNRELEASED; urgency=low
* Work around perl $_ scoping nonsense that caused breakage when loading
external plugins.
* style.css: Add missing semicolon. Closes: #497176
+ * filecheck: Fall back to testing for binary or plain text files
+ if no mime type is detected.
-- Joey Hess <joeyh@debian.org> Thu, 28 Aug 2008 16:08:18 -0400
diff --git a/doc/plugins/filecheck/discussion.mdwn b/doc/plugins/filecheck/discussion.mdwn
index 54b14c183..f91950b7d 100644
--- a/doc/plugins/filecheck/discussion.mdwn
+++ b/doc/plugins/filecheck/discussion.mdwn
@@ -13,29 +13,5 @@ if ::magic() returns undef? --[[DavidBremner]]
>> that if default returns undef, this is returned. As far as I understand
>> the code/doc for File::MimeInfo, under is used only as an error return
>> for ::default
-<pre>
-From 84f40d7fa822c6cc09506cca2dbf38a8b19f8bb7 Mon Sep 17 00:00:00 2001
-From: David Bremner <bremner@unb.ca>
-Date: Fri, 29 Aug 2008 20:46:20 -0300
-Subject: [PATCH] call File::MimeInfo::default if ::magic() returns undef
----
- IkiWiki/Plugin/filecheck.pm | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
-index 9c7a8db..a94c02b 100644
---- a/IkiWiki/Plugin/filecheck.pm
-+++ b/IkiWiki/Plugin/filecheck.pm
-@@ -127,7 +127,7 @@ sub match_mimetype ($$;@) { #{{{
- }
- my $mimetype=File::MimeInfo::Magic::magic($file);
- if (! defined $mimetype) {
-- $mimetype="unknown";
-+ $mimetype=File::MimeInfo::Magic::default($file);
- }
-
- my $regexp=IkiWiki::glob2re($wanted);
---
-1.5.6.3
-</pre>
+>>> Applied