Skip to content

Commit

Permalink
fix: better handling of SVG dimensions (#79)
Browse files Browse the repository at this point in the history
trying to fix the reported bug

Refs: #78
  • Loading branch information
grigoriev authored Sep 26, 2024
1 parent c40b044 commit 89580f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/SvgUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ def to_base64(content):

# Conversion to px
def convert_to_px(value, unit):
value = float(value)
try:
value = float(value)
except ValueError:
logging.error(f"Invalid value for conversion: {value}")
return None

if unit == 'px':
return math.ceil(value)
elif unit == 'pt':
Expand Down

0 comments on commit 89580f2

Please sign in to comment.