Skip to content

Commit

Permalink
SVG-File: avoid attr error on missing dimensions (2)
Browse files Browse the repository at this point in the history
Ref: #1157
  • Loading branch information
zmsbot committed Oct 6, 2023
1 parent dcff181 commit ff2227d
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 ff2227d

Please sign in to comment.