Skip to content

Commit 32c573e

Browse files
authored
fix: empty url error processing event (#4469)
1 parent 3b943bd commit 32c573e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

keep/api/models/alert.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,14 @@ def prepend_https(cls, url):
154154
return url
155155

156156
url = url.strip()
157+
# If the URL is empty, return None to avoid validation errors
158+
if not url:
159+
return None
157160
if not url.startswith("http"):
158161
# @tb: in some cases we drop the event because of invalid url with no scheme
159162
# invalid or missing URL scheme (type=value_error.url.scheme)
160163
url = f"https://{url}"
161-
return urllib.parse.quote(url, safe='/:?=&')
164+
return urllib.parse.quote(url, safe="/:?=&")
162165

163166
@validator("lastReceived", pre=True, always=True)
164167
def validate_last_received(cls, last_received):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "keep"
3-
version = "0.41.12"
3+
version = "0.41.13"
44
description = "Alerting. for developers, by developers."
55
authors = ["Keep Alerting LTD"]
66
packages = [{include = "keep"}]

0 commit comments

Comments
 (0)