diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2024-01-09 20:03:11 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:55 +0100 |
commit | ae1f22190d1305b17f9a05b3e40583790fde7d5d (patch) | |
tree | 7a5e7253f47a01629d0567cff52f23c3a6a65ad7 /slack/slack_message.py | |
parent | 749f38551d5fc8db233aba12c5ca0bf505180ea1 (diff) | |
download | wee-slack-ae1f22190d1305b17f9a05b3e40583790fde7d5d.tar.gz |
Unescape from_url in attachments
It looks like from_url should be unescaped, but title_link and image_url
should not. Slack seems a bit inconsistent here though, as an image in
an attachment will use the unescaped title_link, but the link in the
title itself will use the original (possibly escaped) one. And the title
for the image link will use the original (possibly escaped) title, while
the title in the attachment will unescape it.
I suppose you're not supposed to HTML escape (or Slacks version of it)
URLs in title_link and image_url (which makes sense), but Slack does
escape from_url if you send a message with a link to a thread message,
so we have to handle that.
Diffstat (limited to 'slack/slack_message.py')
-rw-r--r-- | slack/slack_message.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/slack/slack_message.py b/slack/slack_message.py index bb35d4e..50eca1c 100644 --- a/slack/slack_message.py +++ b/slack/slack_message.py @@ -1192,7 +1192,7 @@ class SlackMessage: elif title and not title_link: lines.append([f"{prepend_title_text}{title}"]) prepend_title_text = "" - from_url = attachment.get("from_url", "") + from_url = unhtmlescape(attachment.get("from_url", "")) if ( not any( isinstance(text, str) and from_url in text for text in items_before |