webhooks/sentry: Fix URL generated in transform_webhook_payload.

The URL incorrectly had `event` in the URL path, instead of `events`.

Closes #16783
This commit is contained in:
Puneeth Chaganti 2020-12-02 10:52:44 +05:30 committed by Alex Vandiver
parent b7a08323aa
commit 5dc3489166
2 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,7 @@ Traceback:
def test_webhook_event_for_exception_python(self) -> None: def test_webhook_event_for_exception_python(self) -> None:
expected_topic = "ValueError: new sentry error." expected_topic = "ValueError: new sentry error."
expected_message = """ 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 ```quote
**level:** error **level:** error
**timestamp:** 2020-10-21 23:25:11 **timestamp:** 2020-10-21 23:25:11
@ -108,7 +108,7 @@ Traceback:
def test_webhook_event_for_exception_javascript(self) -> None: def test_webhook_event_for_exception_javascript(self) -> None:
expected_topic = 'TypeError: can\'t access property "bar", x.foo is undefined' expected_topic = 'TypeError: can\'t access property "bar", x.foo is undefined'
expected_message = """ 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 ```quote
**level:** error **level:** error
**timestamp:** 2020-10-26 16:39:54 **timestamp:** 2020-10-26 16:39:54

View File

@ -236,7 +236,7 @@ def transform_webhook_payload(payload: Dict[str, Any]) -> Optional[Dict[str, Any
if not event_id: if not event_id:
return None return None
event_path = f"event/{event_id}/" event_path = f"events/{event_id}/"
event['web_url'] = urljoin(payload['url'], event_path) event['web_url'] = urljoin(payload['url'], event_path)
timestamp = event.get('timestamp', event['received']) timestamp = event.get('timestamp', event['received'])
event['datetime'] = datetime.fromtimestamp(timestamp).isoformat() event['datetime'] = datetime.fromtimestamp(timestamp).isoformat()