bbj-dev / bbj

Bulletin Butter & Jelly: An HTTP bulletin board server for small communities
https://bbj-dev.github.io/bbj/site/
MIT License
71 stars 10 forks source link

urwid crashes on search_thread_callback #23

Closed Mroik closed 3 months ago

Mroik commented 3 months ago

BBJ crashes when finding a match using the search feature in a thread. It seems that some messages return without post_id when fetched using thread_load from clients/urwid/network.py (used on line 991). Couldn't say more 'cause I'm not sure which endpoint it references but here's the traceback.

This behaviour is triggered by searching mroik or dozens in the Mastodon thread made by wingy on tilde.town

Traceback (most recent call last):
  File "/home/disco/bbj/clients/urwid/main.py", line 2873, in <module>
    main()
  File "/home/disco/bbj/clients/urwid/main.py", line 2867, in main
    app.loop.run()
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 287, in run
    self._run()
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 385, in _run
    self.event_loop.run()
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 790, in run
    self._loop()
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 827, in _loop
    self._watch_files[fd]()
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/raw_display.py", line 416, in <lambda>
    wrapper = lambda: self.parse_input(
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/raw_display.py", line 515, in parse_input
    callback(processed, processed_codes)
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 412, in _update
    self.process_input(keys)
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/main_loop.py", line 513, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/container.py", line 598, in keypress
    return self.top_w.keypress(self.top_w_size(size,
  File "/home/disco/bbj/clients/urwid/main.py", line 2308, in keypress
    elif not super(OptionsMenu, self).keypress(size, key):
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/container.py", line 1626, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/container.py", line 2316, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/home/disco/venv/lib/python3.10/site-packages/urwid/listbox.py", line 968, in keypress
    key = focus_widget.keypress((maxcol,),key)
  File "/home/disco/bbj/clients/urwid/main.py", line 2072, in keypress
    self.callback(self.get_edit_text(), *self.args)
  File "/home/disco/bbj/clients/urwid/main.py", line 1041, in search_thread_callback
    self.match_data["matches"] = [
  File "/home/disco/bbj/clients/urwid/main.py", line 1042, in <listcomp>
    self.thread["messages"][widget.base_widget.post_id] for widget in self.walker
AttributeError: 'MessageBody' object has no attribute 'post_id'
Error: exit status 1
desvox commented 3 months ago

thanks for filing this issue! the problem should be fixed now.