diff options
author | Simon McVittie <smcv@debian.org> | 2018-02-28 09:51:13 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2018-02-28 09:56:08 +0000 |
commit | 54095ea655b63ab8f2cefba43622df683f89e4fe (patch) | |
tree | f1a8ac0561855c15d72dbeb71511fe9a5cc6b9ee /IkiWiki | |
parent | f446e7ca5fee39f7fb7db171221d1cdf6d7f4f9e (diff) | |
download | ikiwiki-54095ea655b63ab8f2cefba43622df683f89e4fe.tar ikiwiki-54095ea655b63ab8f2cefba43622df683f89e4fe.tar.gz |
img: Explicitly detect format if needed
An empty coder name used to detect the format implicitly, but has been
interpreted as a literal part of the filename since ImageMagick 6.9.8-3.
In newer versions, there does not seem to be any way to indicate that
a filename containing ':' is to be taken literally without first
knowing the decoder to use.
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/img.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 79cfba20f..b85824345 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -125,7 +125,14 @@ sub preprocess (@) { } else { # allow ImageMagick to auto-detect (potentially dangerous) - $format = ''; + my $im = Image::Magick->new(); + my $r = $im->Ping(file => $in); + if ($r) { + $format = lc $r; + } + else { + error sprintf(gettext("failed to determine format of %s"), $file); + } } error sprintf(gettext("%s image processing disabled in img_allowed_formats configuration"), $format ? $format : "\"$extension\"") unless allowed($format ? $format : "everything"); |