Escape Hyphen in Regular Expression (#4006)

* Escape Hyphen in Regular Expression

* Add Test

* Fix Linting Errors

* Use Pytest Parameterize Marker

* Fix Black Formatting Errors

* Interpolate / Use Raw String

* fixes string formatting

Co-authored-by: Correna Sprowls <correna.sprowls@joinroot.com>
This commit is contained in:
Kyle Decot 2021-06-11 16:54:43 -04:00 committed by GitHub
commit 8d4007f2b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 21 deletions

View file

@ -1007,7 +1007,7 @@ class SimpleSystemManagerBackend(BaseBackend):
if (
"//" in value
or not value.startswith("/")
or not re.match("^[a-zA-Z0-9_.-/]*$", value)
or not re.match(r"^[a-zA-Z0-9_.\-/]*$", value)
):
raise ValidationException(
'The parameter doesn\'t meet the parameter name requirements. The parameter name must begin with a forward slash "/". '