signal2html icon indicating copy to clipboard operation
signal2html copied to clipboard

DB v146 KeyError: 'location'

Open doegox opened this issue 3 years ago • 2 comments
trafficstars

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 avatar Jul 17 '22 11:07 doegox

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).

doegox avatar Jul 21 '22 18:07 doegox

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

GjjvdBurg avatar Jul 21 '22 21:07 GjjvdBurg

My PR #74 should fix that.

webtroter avatar Dec 08 '22 16:12 webtroter

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

doegox avatar Dec 08 '22 17:12 doegox

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: @.***>

webtroter avatar Dec 08 '22 17:12 webtroter

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

GjjvdBurg avatar Feb 03 '23 22:02 GjjvdBurg