diff options
-rw-r--r-- | _pytest/test_unwrap_attachments.py | 13 | ||||
-rw-r--r-- | wee_slack.py | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/_pytest/test_unwrap_attachments.py b/_pytest/test_unwrap_attachments.py index e70256e..8b22515 100644 --- a/_pytest/test_unwrap_attachments.py +++ b/_pytest/test_unwrap_attachments.py @@ -45,6 +45,19 @@ import pytest { 'input_message': {'attachments': [{ 'title': 'Title', + 'text': 'Attachment text', + 'title_link': 'http://link', + 'from_url': 'http://link', + }]}, + 'input_text_before': "", + 'output': "\n".join([ + "Title (http://link)", + "Attachment text", + ]), + }, + { + 'input_message': {'attachments': [{ + 'title': 'Title', 'text': 'Attachment text\n\n\nWith multiple lines', }]}, 'input_text_before': "", diff --git a/wee_slack.py b/wee_slack.py index 90b56ac..950117c 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2629,7 +2629,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: + if from_url not in text_before and from_url != title_link: t.append(from_url) atext = attachment.get("text", None) |