mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6403 from tk0miya/6402_unknown_image
Fix #6402: image directive crashes by unknown image format
This commit is contained in:
commit
29336e6c45
1
CHANGES
1
CHANGES
@ -130,6 +130,7 @@ Bugs fixed
|
|||||||
* #6378: linkcheck: Send commonly used User-Agent
|
* #6378: linkcheck: Send commonly used User-Agent
|
||||||
* #6387: html search: failed to search document with haiku and scrolls themes
|
* #6387: html search: failed to search document with haiku and scrolls themes
|
||||||
* #6406: Wrong year is returned for ``SOURCE_DATE_EPOCH``
|
* #6406: Wrong year is returned for ``SOURCE_DATE_EPOCH``
|
||||||
|
* #6402: image directive crashes by unknown image format
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -100,6 +100,9 @@ class ImageCollector(EnvironmentCollector):
|
|||||||
filename)
|
filename)
|
||||||
try:
|
try:
|
||||||
mimetype = guess_mimetype(filename)
|
mimetype = guess_mimetype(filename)
|
||||||
|
if mimetype is None:
|
||||||
|
basename, suffix = path.splitext(filename)
|
||||||
|
mimetype = 'image/x-' + suffix[1:]
|
||||||
if mimetype not in candidates:
|
if mimetype not in candidates:
|
||||||
globbed.setdefault(mimetype, []).append(new_imgpath)
|
globbed.setdefault(mimetype, []).append(new_imgpath)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
|
Loading…
Reference in New Issue
Block a user