diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-05-28 21:33:56 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-05-30 00:56:31 +0900 |
| commit | 3456ea7a725601bdb77cd4df04bfa53de85f818b (patch) | |
| tree | f21d30d6f912ed1ca8c2e600514fdd8689c3f340 /sphinx/environment | |
| parent | eea9fbbdaefe39cdac1c9fa25c6a2be381abe706 (diff) | |
| download | sphinx-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.py | 3 |
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: |
