Skip to content

Commit

Permalink
SVG-File: avoid attr error on missing dimensions (2) (#1170)
Browse files Browse the repository at this point in the history
Ref: #1157

Co-authored-by: zmsbot <zmsbot@zms.hosting>
Co-authored-by: Jens Vagelpohl <jens@plyp.com>
  • Loading branch information
3 people committed Oct 14, 2023
1 parent d87e918 commit 533df73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/OFS/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 533df73

Please sign in to comment.