Skip to content

Commit 0cfb0ef

Browse files
committed
updated regex
1 parent b7391b4 commit 0cfb0ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

splitio/client/input_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
EVENT_TYPE_PATTERN = r'^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$'
1717
MAX_PROPERTIES_LENGTH_BYTES = 32768
1818
_FLAG_SETS_REGEX = '^[a-z0-9][_a-z0-9]{0,49}$'
19-
_FALLBACK_TREATMENT_REGEX = '^[a-zA-Z][a-zA-Z0-9-_;]+$'
19+
_FALLBACK_TREATMENT_REGEX = '^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$'
2020
_FALLBACK_TREATMENT_SIZE = 100
2121

2222
def _check_not_null(value, name, operation):

tests/client/test_input_validator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,19 +1645,19 @@ def test_fallback_treatments(self, mocker):
16451645
_logger.reset_mock()
16461646
assert not input_validator.validate_fallback_treatment(FallbackTreatment("on/c"))
16471647
assert _logger.warning.mock_calls == [
1648-
mocker.call("Config: Fallback treatment should match regex %s", "^[a-zA-Z][a-zA-Z0-9-_;]+$")
1648+
mocker.call("Config: Fallback treatment should match regex %s", "^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$")
16491649
]
16501650

16511651
_logger.reset_mock()
16521652
assert not input_validator.validate_fallback_treatment(FallbackTreatment("9on"))
16531653
assert _logger.warning.mock_calls == [
1654-
mocker.call("Config: Fallback treatment should match regex %s", "^[a-zA-Z][a-zA-Z0-9-_;]+$")
1654+
mocker.call("Config: Fallback treatment should match regex %s", "^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$")
16551655
]
16561656

16571657
_logger.reset_mock()
16581658
assert not input_validator.validate_fallback_treatment(FallbackTreatment("on$as"))
16591659
assert _logger.warning.mock_calls == [
1660-
mocker.call("Config: Fallback treatment should match regex %s", "^[a-zA-Z][a-zA-Z0-9-_;]+$")
1660+
mocker.call("Config: Fallback treatment should match regex %s", "^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$")
16611661
]
16621662

16631663
assert input_validator.validate_fallback_treatment(FallbackTreatment("on_c"))

0 commit comments

Comments
 (0)