mirror of
				https://github.com/retspen/webvirtcloud
				synced 2025-07-31 12:41:08 +00:00 
			
		
		
		
	enhancement: optimize regular expressions
This commit is contained in:
		
							parent
							
								
									ad7781b545
								
							
						
					
					
						commit
						1be57f987e
					
				
					 1 changed files with 1 additions and 3 deletions
				
			
		|  | @ -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_])|(?:\.)|((?<!\/)-))*)+$", target) | ||||
|         if storage_type in ["dir", "netfs"] and not have_symbol: | ||||
|             raise forms.ValidationError( | ||||
|                 _("The target must not contain any special characters") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue