Skip to content

Commit

Permalink
Fix for TUI crash bug #487
Browse files Browse the repository at this point in the history
  • Loading branch information
danschwarz authored and ihabunek committed Aug 12, 2024
1 parent 4ae9443 commit 727fec4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions toot/tui/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,16 @@ def content_generator(self, status, reblogged_by):
yield self.image_widget(m["url"], aspect=aspect)
yield urwid.Divider()
# video media may include a preview URL, show that as a fallback
elif m["preview_url"].lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp')):
yield urwid.Text("")
try:
aspect = float(m["meta"]["small"]["aspect"])
except Exception:
aspect = None
if image_support_enabled():
yield self.image_widget(m["preview_url"], aspect=aspect)
yield urwid.Divider()
elif m["preview_url"]:
if m["preview_url"].lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp')):
yield urwid.Text("")
try:
aspect = float(m["meta"]["small"]["aspect"])
except Exception:
aspect = None
if image_support_enabled():
yield self.image_widget(m["preview_url"], aspect=aspect)
yield urwid.Divider()
yield ("pack", url_to_widget(m["url"]))

poll = status.original.data.get("poll")
Expand Down

0 comments on commit 727fec4

Please sign in to comment.