GjjvdBurg / signal2html

Export a Signal backup to pretty HTML
MIT License
111 stars 15 forks source link

DB v146 KeyError: 'location' #69

Closed doegox closed 1 year ago

doegox commented 2 years ago

Hello,

I got the following error when testing signal2html on a fresh backup.

2022-07-17 12:54:50 | INFO - This is signal2html version 0.2.9
2022-07-17 12:54:50 | INFO - Found Signal database version: 146.
2022-07-17 12:54:50 | WARNING - This database version is untested, please report errors.
2022-07-17 12:54:50 | INFO - Group for recipient 616 is '__signal_mms_group__!0a91b7e96a7748b4e8b44ee8e75d0dba' and will be called by group id using name 'Group 2'.
2022-07-17 12:54:50 | INFO - Group for recipient 617 is '__signal_mms_group__!9d36a9e95af23aa812f2e1cb1088f9d1' and will be called by group id using name 'Group 1'.
Traceback (most recent call last):
  File "/usr/local/bin/signal2html", line 33, in <module>
    sys.exit(load_entry_point('signal2html', 'console_scripts', 'signal2html')())
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/__main__.py", line 20, in main
    sys.exit(main())
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/ui.py", line 35, in main
    process_backup(args.input_dir, args.output_dir)
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/core.py", line 693, in process_backup
    dump_thread(t, output_dir)
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/html.py", line 271, in dump_thread
    body = format_message(body, thread.mentions.get(msg._id))
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/html.py", line 59, in format_message
    emoji_lookup = {p["location"]: p["emoji"] for p in emoji_pos}
  File "/home/phil/devel/00orig/signal/signal2html/signal2html/html.py", line 59, in <dictcomp>
    emoji_lookup = {p["location"]: p["emoji"] for p in emoji_pos}
KeyError: 'location'

I tested with regular pip install, then with pip install -e from a git clone.

Note that to get the code working at first, I had to fix this typo:

diff --git a/signal2html/html.py b/signal2html/html.py
index 53cf0a2..7a7098c 100644
--- a/signal2html/html.py
+++ b/signal2html/html.py
@@ -11,7 +11,7 @@ import logging

 from types import SimpleNamespace as ns

-from emoji import emoji_lis as emoji_list
+from emoji import emoji_list as emoji_list
 from jinja2 import Environment
doegox commented 2 years ago

Some progress: I could get it running by changing the location key by match_start. Now it dumps the HTML. But it doesn't show the reactions. From the code it seems it was previously in mms table while it has now its own table (from what I understood from a quick look).

GjjvdBurg commented 2 years ago

Thanks for reporting this @doegox! The reaction issue is reported here as well, and would indeed require updating the table these are retrieved from

webtroter commented 1 year ago

My PR #74 should fix that.

doegox commented 1 year ago

@webtroter you mean https://github.com/GjjvdBurg/signal2html/pull/74 I guess

webtroter commented 1 year ago

Yes you're right

On Thu., Dec. 8, 2022, 12:06 Philippe Teuwen, @.***> wrote:

@webtroter https://github.com/webtroter you mean #74 https://github.com/GjjvdBurg/signal2html/pull/74 I guess

— Reply to this email directly, view it on GitHub https://github.com/GjjvdBurg/signal2html/issues/69#issuecomment-1343029246, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB77R6AHTVUQPXSIR3SS2STWMIIRBANCNFSM53ZSFESQ . You are receiving this because you were mentioned.Message ID: @.***>

GjjvdBurg commented 1 year ago

Closing this as #74 has been merged. Problems with reactions are reported elsewhere too.