summaryrefslogtreecommitdiff
path: root/sphinx/environment
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-05-28 21:33:56 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-05-30 00:56:31 +0900
commit3456ea7a725601bdb77cd4df04bfa53de85f818b (patch)
treef21d30d6f912ed1ca8c2e600514fdd8689c3f340 /sphinx/environment
parenteea9fbbdaefe39cdac1c9fa25c6a2be381abe706 (diff)
downloadsphinx-git-3456ea7a725601bdb77cd4df04bfa53de85f818b.tar.gz
Fix #6402: image directive crashes by unknown image format
Diffstat (limited to 'sphinx/environment')
-rw-r--r--sphinx/environment/collectors/asset.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/environment/collectors/asset.py b/sphinx/environment/collectors/asset.py
index a0c009463..572dea7a4 100644
--- a/sphinx/environment/collectors/asset.py
+++ b/sphinx/environment/collectors/asset.py
@@ -100,6 +100,9 @@ class ImageCollector(EnvironmentCollector):
filename)
try:
mimetype = guess_mimetype(filename)
+ if mimetype is None:
+ basename, suffix = path.splitext(filename)
+ mimetype = 'image/x-' + suffix[1:]
if mimetype not in candidates:
globbed.setdefault(mimetype, []).append(new_imgpath)
except OSError as err: