From ff2227d69440a59712e1991d65b4ea91cab19c1e Mon Sep 17 00:00:00 2001 From: zmsbot Date: Sat, 7 Oct 2023 00:07:41 +0200 Subject: [PATCH] SVG-File: avoid attr error on missing dimensions (2) Ref: https://github.com/zopefoundation/Zope/pull/1157 --- src/OFS/Image.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OFS/Image.py b/src/OFS/Image.py index 01bd0cbb01..7aa4972f54 100644 --- a/src/OFS/Image.py +++ b/src/OFS/Image.py @@ -939,9 +939,9 @@ def getImageInfo(data): xmldoc = minidom.parseString(data) except Exception: return content_type, width, height + w = width + h = height for svg in xmldoc.getElementsByTagName('svg'): - w = width - h = height content_type = 'image/svg+xml' if 'height' in svg.attributes and 'width' in svg.attributes: w = svg.attributes['width'].value @@ -965,8 +965,8 @@ def getImageInfo(data): viewBox = [int(float(x)) for x in viewBox.split(' ')] w = viewBox[2] - viewBox[0] h = viewBox[3] - viewBox[1] - width = int(w) - height = int(h) + width = int(w) + height = int(h) return content_type, width, height