diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-09-17 07:04:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 07:04:15 -0400 |
commit | c3c9732c5363ef007dd838dea016719d3ab07a89 (patch) | |
tree | c0693f1120b6240e3b823f4b438c70085a4d7445 /synapse/rest/admin/_base.py | |
parent | Fix a potential bug of UnboundLocalError (#8329) (diff) | |
download | synapse-c3c9732c5363ef007dd838dea016719d3ab07a89.tar.xz |
Use admin_patterns for all admin APIs. (#8331)
This reduces duplication of the admin prefix in regular expressions.
Diffstat (limited to 'synapse/rest/admin/_base.py')
-rw-r--r-- | synapse/rest/admin/_base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/rest/admin/_base.py b/synapse/rest/admin/_base.py index d82eaf5e38..db9fea263a 100644 --- a/synapse/rest/admin/_base.py +++ b/synapse/rest/admin/_base.py @@ -44,7 +44,7 @@ def historical_admin_path_patterns(path_regex): ] -def admin_patterns(path_regex: str): +def admin_patterns(path_regex: str, version: str = "v1"): """Returns the list of patterns for an admin endpoint Args: @@ -54,7 +54,7 @@ def admin_patterns(path_regex: str): Returns: A list of regex patterns. """ - admin_prefix = "^/_synapse/admin/v1" + admin_prefix = "^/_synapse/admin/" + version patterns = [re.compile(admin_prefix + path_regex)] return patterns |