From 5dc348916605ee56ab75ee289cd331d4581690bd Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Wed, 2 Dec 2020 10:52:44 +0530 Subject: [PATCH] webhooks/sentry: Fix URL generated in transform_webhook_payload. The URL incorrectly had `event` in the URL path, instead of `events`. Closes #16783 --- zerver/webhooks/sentry/tests.py | 4 ++-- zerver/webhooks/sentry/view.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py index 9d059e44c0..7c06f8ea0f 100644 --- a/zerver/webhooks/sentry/tests.py +++ b/zerver/webhooks/sentry/tests.py @@ -85,7 +85,7 @@ Traceback: def test_webhook_event_for_exception_python(self) -> None: expected_topic = "ValueError: new sentry error." expected_message = """ -**New exception:** [ValueError: new sentry error.](https://sentry.io/organizations/bar-foundation/issues/1972208801/event/c916dccfd58e41dcabaebef0091f0736/) +**New exception:** [ValueError: new sentry error.](https://sentry.io/organizations/bar-foundation/issues/1972208801/events/c916dccfd58e41dcabaebef0091f0736/) ```quote **level:** error **timestamp:** 2020-10-21 23:25:11 @@ -108,7 +108,7 @@ Traceback: def test_webhook_event_for_exception_javascript(self) -> None: expected_topic = 'TypeError: can\'t access property "bar", x.foo is undefined' expected_message = """ -**New exception:** [TypeError: can't access property "bar", x.foo is undefined](https://sentry.io/organizations/foo-bar-org/issues/1982047746/event/f3bf5fc4e354451db9e885a69b2a2b51/) +**New exception:** [TypeError: can't access property "bar", x.foo is undefined](https://sentry.io/organizations/foo-bar-org/issues/1982047746/events/f3bf5fc4e354451db9e885a69b2a2b51/) ```quote **level:** error **timestamp:** 2020-10-26 16:39:54 diff --git a/zerver/webhooks/sentry/view.py b/zerver/webhooks/sentry/view.py index ccee092785..1959512901 100644 --- a/zerver/webhooks/sentry/view.py +++ b/zerver/webhooks/sentry/view.py @@ -236,7 +236,7 @@ def transform_webhook_payload(payload: Dict[str, Any]) -> Optional[Dict[str, Any if not event_id: return None - event_path = f"event/{event_id}/" + event_path = f"events/{event_id}/" event['web_url'] = urljoin(payload['url'], event_path) timestamp = event.get('timestamp', event['received']) event['datetime'] = datetime.fromtimestamp(timestamp).isoformat()