canonical / observability-libs

https://charmhub.io/observability-libs
Apache License 2.0
3 stars 8 forks source link

Fix typo in is_valid_uuid regex #17

Closed Abuelodelanada closed 2 years ago

Abuelodelanada commented 2 years ago

Issue

This PR fixes #16

Solution

Fix a typo in the regex that validates UUID

Context

The change is simple:

@@ -128,7 +128,7 @@ class JujuTopology:
     def is_valid_uuid(self, uuid):
         """Validates the supplied UUID against the Juju Model UUID pattern."""
         regex = re.compile(
-            "^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$"
+            "^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$"
         )
         return bool(regex.match(uuid))

Testing Instructions

Run unit test. We added a new one: test_invalid_uuid

Release Notes

Fix typo in the regular expression that validates UUID in the method is_valid_uuid