forked from wolever/wayslack
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Some of our channels had canvases in them, which are saved as files called _channels/[cid]/canvas_in_the_conversation.json (as opposed to files named using YYYY-MM-DD.json, like all other messages).
Instead of containing messages, this file contains file entries that look like this:
[
{
"id": "F0...",
"created": 16...,
"name": "Untitled",
"title": "Untitled",
"mimetype": "application\/vnd.slack-docs",
"filetype": "quip",
"pretty_type": "Canvas",
"user": "USLACKBOT",
"editable": true,
"size": 35,
"mode": "quip",
"is_public": true,
"is_tombstoned": false,
"public_url_shared": false,
"date_delete": 0,
"url_private_download": "https:\/\/files.slack.com\/files-pri\/...",
"shares": [
{
"team": "T0...",
"channel": "C1..."
}
]
}
]
Unfortunately, wayslack tries to read these as messages, and crashes with the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/wayslack", line 8, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 1513, in main
archive.refresh()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 1293, in refresh
sub.refresh()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 889, in refresh
BaseArchiver.refresh(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 821, in refresh
obj.refresh()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 576, in refresh
self._refresh_messages()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 682, in _refresh_messages
last_saved_replies_ts = get_last_saved_replies_ts()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 618, in get_last_saved_replies_ts
for msg in sorted(self.load_messages(archive), key=lambda m: m["ts"], reverse=True):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wayslack.py", line 618, in <lambda>
for msg in sorted(self.load_messages(archive), key=lambda m: m["ts"], reverse=True):
KeyError: 'ts'
In my case, I just deleted these canvas_in_the_conversation.json files after verifying the files they pointed to were empty canvases (just people pressing the button by accident). However, a more general solution should be to ignore these files completely.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels