From 449dfa56a6944e3639dbbe75ea48f06dfc826f0d Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 13 Dec 2023 12:44:24 +0100 Subject: [PATCH 1/2] Filter out empty string releases --- sentry_sdk/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index bf452c60a8..d547e363b6 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -130,7 +130,7 @@ def get_default_release(): return release release = get_git_revision() - if release is not None: + if release: return release for var in ( From fb23ac3f385e8620ed1199c91bbdcc7789017b33 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 13 Dec 2023 12:56:15 +0100 Subject: [PATCH 2/2] add tests --- tests/test_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index f8cc7874cd..71657f75c7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -5,6 +5,7 @@ from sentry_sdk.utils import ( Components, Dsn, + get_default_release, get_error_message, get_git_revision, is_valid_sample_rate, @@ -579,3 +580,15 @@ def test_devnull_not_found(): revision = get_git_revision() assert revision is None + + +def test_default_release(): + release = get_default_release() + assert release is not None + + +def test_default_release_empty_string(): + with mock.patch("sentry_sdk.utils.get_git_revision", return_value=""): + release = get_default_release() + + assert release is None