mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	域名解析域名和记录名中支持中文
This commit is contained in:
		@@ -18,8 +18,8 @@ func ValidateDomainFormat(domain string) bool {
 | 
			
		||||
			strings.HasPrefix(piece, "-") ||
 | 
			
		||||
			strings.HasSuffix(piece, "-") ||
 | 
			
		||||
			len(piece) > 63 ||
 | 
			
		||||
			// 我们允许大写字母、下划线,防止有些特殊场景下需要
 | 
			
		||||
			!regexp.MustCompile(`^[_a-zA-Z0-9-]+$`).MatchString(piece) {
 | 
			
		||||
			// 我们允许中文、大写字母、下划线,防止有些特殊场景下需要
 | 
			
		||||
			!regexp.MustCompile(`^[\p{Han}_a-zA-Z0-9-]+$`).MatchString(piece) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -77,8 +77,8 @@ func ValidateRecordName(name string) bool {
 | 
			
		||||
			strings.HasSuffix(piece, "-") ||
 | 
			
		||||
			//strings.Contains(piece, "--") ||
 | 
			
		||||
			len(piece) > 63 ||
 | 
			
		||||
			// 我们允许大写字母、下划线,防止有些特殊场景下需要
 | 
			
		||||
			!regexp.MustCompile(`^[_a-zA-Z0-9-]+$`).MatchString(piece) {
 | 
			
		||||
			// 我们允许中文、大写字母、下划线,防止有些特殊场景下需要
 | 
			
		||||
			!regexp.MustCompile(`^[\p{Han}_a-zA-Z0-9-]+$`).MatchString(piece) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user