Skip to content

Commit

Permalink
Merge pull request #6053 from roed314/fix_pic
Browse files Browse the repository at this point in the history
Better fix for svg image
  • Loading branch information
AndrewVSutherland authored May 18, 2024
2 parents 04b2ebf + e9da226 commit 7722d48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lmfdb/groups/abstract/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ def picture_page():
learnmore=learnmore_list_remove("Picture")
)

@abstract_page.route("picture/<label>")
@abstract_page.route("picture/<label>.svg")
def picture(label):
if label_is_valid(label):
label = clean_input(label)
Expand All @@ -1642,11 +1642,10 @@ def picture(label):
flash_error("Error generating image for %s.", label)
return redirect(url_for(".index"))
else:
img = f'<!DOCTYPE html>\n<html lang="en">\n<body>\n{img}</body></html>'
svg_io = BytesIO()
svg_io.write(img.encode("utf-8"))
svg_io.seek(0)
return send_file(svg_io, mimetype='text/html') #, mimetype='image/svg+xml')
return send_file(svg_io, mimetype='image/svg+xml')
else:
flash_error("The label %s is invalid.", label)
return redirect(url_for(".index"))
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/groups/abstract/web_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ def image(self):
else:
R = 1
circles = ""
return f'<img><svg xmlns="https://www.w3.org/2000/svg" viewBox="-{R} -{R} {2*R} {2*R}" width="200" height="150">\n{circles}</svg></img>'
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-{R} -{R} {2*R} {2*R}" width="200" height="150">\n{circles}</svg>'

# The following attributes are used in create_boolean_string
@property
Expand Down

0 comments on commit 7722d48

Please sign in to comment.