From 1be57f987e43b9f8e46fa10f299256c2c88eeb1e Mon Sep 17 00:00:00 2001 From: weidong Date: Mon, 26 Dec 2022 11:35:44 +0800 Subject: [PATCH] enhancement: optimize regular expressions --- storages/forms.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/storages/forms.py b/storages/forms.py index d2a7ef4..38715e1 100644 --- a/storages/forms.py +++ b/storages/forms.py @@ -38,9 +38,7 @@ class AddStgPool(forms.Form): def clean_target(self): storage_type = self.cleaned_data["stg_type"] target = self.cleaned_data["target"] - have_symbol = re.match("^[^-][a-zA-Z0-9/_-]+$", target) and not re.match( - ".*/-", target - ) + have_symbol = re.match("^[^-](\/?((?:[0-9a-zA-Z_])|(?:\.)|((?