From fc4d6b8221de16e49c3e6c7abb8b77e156d006f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Csord=C3=A1s?= Date: Thu, 19 Apr 2018 10:24:47 +0200 Subject: [PATCH] Allow more product endpoint names to be valid Product endpoint names can be started with digits or underscores. --- libcodechecker/server/routing.py | 4 +--- tests/functional/products/test_products.py | 8 -------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/libcodechecker/server/routing.py b/libcodechecker/server/routing.py index 004fd3e481..2f25893792 100644 --- a/libcodechecker/server/routing.py +++ b/libcodechecker/server/routing.py @@ -47,9 +47,7 @@ def is_valid_product_endpoint(uripart): if uripart in NON_PRODUCT_ENDPOINTS: return False - # Like programming variables: begin with letter and then letters, numbers, - # underscores. - pattern = r'^[A-Za-z][A-Za-z0-9_]*$' + pattern = r'^[A-Za-z0-9_]+$' if not re.match(pattern, uripart): return False diff --git a/tests/functional/products/test_products.py b/tests/functional/products/test_products.py index e1b12c43ef..bc89ab5257 100644 --- a/tests/functional/products/test_products.py +++ b/tests/functional/products/test_products.py @@ -98,14 +98,6 @@ def test_add_invalid_product(self): ) product_cfg.connection = dbc - with self.assertRaises(RequestFailed): - product_cfg.endpoint = "_INVALID" - self._root_client.addProduct(product_cfg) - - with self.assertRaises(RequestFailed): - product_cfg.endpoint = "0foobar" - self._root_client.addProduct(product_cfg) - with self.assertRaises(RequestFailed): product_cfg.endpoint = "$$$$$$$" self._root_client.addProduct(product_cfg)