aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_pytest/test_unwrap_attachments.py6
-rw-r--r--wee_slack.py5
2 files changed, 6 insertions, 5 deletions
diff --git a/_pytest/test_unwrap_attachments.py b/_pytest/test_unwrap_attachments.py
index 8e41662..ee5bd8b 100644
--- a/_pytest/test_unwrap_attachments.py
+++ b/_pytest/test_unwrap_attachments.py
@@ -32,10 +32,10 @@ import pytest
'input_message': {'attachments': [{
'title': 'Title',
'text': 'Attachment text',
- 'title_link': 'http://link',
- 'from_url': 'http://link',
+ 'title_link': 'http://link?a=1&b=2',
+ 'from_url': 'http://link?a=1&b=2',
}]},
- 'input_text_before': "http://link",
+ 'input_text_before': "http://link?a=1&b=2",
'output': "\n".join([
"",
"Title",
diff --git a/wee_slack.py b/wee_slack.py
index 334a8ba..9e9202c 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2600,6 +2600,7 @@ def unhtmlescape(text):
def unwrap_attachments(message_json, text_before):
+ text_before_unescaped = unhtmlescape(text_before)
attachment_texts = []
a = message_json.get("attachments", None)
if a:
@@ -2620,7 +2621,7 @@ def unwrap_attachments(message_json, text_before):
t.append(attachment['pretext'])
title = attachment.get('title', None)
title_link = attachment.get('title_link', '')
- if title_link in text_before:
+ if title_link in text_before_unescaped:
title_link = ''
if title and title_link:
t.append('%s%s (%s)' % (prepend_title_text, title, title_link,))
@@ -2629,7 +2630,7 @@ def unwrap_attachments(message_json, text_before):
t.append('%s%s' % (prepend_title_text, title,))
prepend_title_text = ''
from_url = attachment.get('from_url', '')
- if from_url not in text_before and from_url != title_link:
+ if from_url not in text_before_unescaped and from_url != title_link:
t.append(from_url)
atext = attachment.get("text", None)