summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-09 22:22:27 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-09 22:22:27 +0900
commit6cdc09272e17dea0c7c6bc77f0cdcc0867a9e8fc (patch)
tree7073e8fdee52b63b30cac012d554bc823e3422b3
parentc86e17d4be336286e31e8252b13b9f85d5a7b750 (diff)
downloadsphinx-git-6cdc09272e17dea0c7c6bc77f0cdcc0867a9e8fc.tar.gz
Fix #7120: html: crashed when on scaling SVG images which have float dimentions
-rw-r--r--CHANGES2
-rw-r--r--sphinx/util/images.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 667e2e033..c0e68887a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
+* #7120: html: crashed when on scaling SVG images which have float dimentions
+
Testing
--------
diff --git a/sphinx/util/images.py b/sphinx/util/images.py
index 4746e1c40..506e4a931 100644
--- a/sphinx/util/images.py
+++ b/sphinx/util/images.py
@@ -45,6 +45,8 @@ def get_image_size(filename: str) -> Tuple[int, int]:
size = imagesize.get(filename)
if size[0] == -1:
size = None
+ elif isinstance(size[0], float) or isinstance(size[1], float):
+ size = (int(size[0]), int(size[1]))
if size is None and Image: # fallback to Pillow
im = Image.open(filename)