mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
webhooks/jira: Decode topics on our end.
The problem addressed in 006e47198c
resurfaces with topics when a user provides a custom topic in the
webhook URL.
This commit is contained in:
@@ -66,6 +66,14 @@ class JiraHookTests(WebhookTestCase):
|
||||
self.assertEqual(msg.content, expected_message)
|
||||
self.assertEqual(msg.topic_name(), expected_topic)
|
||||
|
||||
def test_created_with_topic_with_spaces_double_escaped(self) -> None:
|
||||
self.url = self.build_webhook_url(topic=quote(quote('alerts test')))
|
||||
expected_topic = "alerts test"
|
||||
expected_message = """Leo Franchi **created** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) priority Major, assigned to **no one**:
|
||||
|
||||
> New bug with hook"""
|
||||
self.send_and_test_stream_message('created_v1', expected_topic, expected_message)
|
||||
|
||||
def test_created_with_unicode(self) -> None:
|
||||
expected_topic = u"BUG-15: New bug with à hook"
|
||||
expected_message = u"""Leo Franchià **created** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) priority Major, assigned to **no one**:
|
||||
|
||||
@@ -243,5 +243,5 @@ def api_jira_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
||||
check_send_webhook_message(request, user_profile,
|
||||
subject, content,
|
||||
unquote_stream=True)
|
||||
unquote_url_parameters=True)
|
||||
return json_success()
|
||||
|
||||
Reference in New Issue
Block a user