mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	修复华为云DNS TXT记录值不加引号无法添加的问题
This commit is contained in:
		@@ -1339,6 +1339,12 @@ func (this *HuaweiDNSProvider) AddRecord(domain string, newRecord *dnstypes.Reco
 | 
			
		||||
	if ttl <= 0 {
 | 
			
		||||
		ttl = 300
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 华为云TXT需要加引号
 | 
			
		||||
	if newRecord.Type == dnstypes.RecordTypeTXT {
 | 
			
		||||
		newRecord.Value = "\"" + strings.Trim(newRecord.Value, "\"") + "\""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = this.doAPI(http.MethodPost, "/v2.1/zones/"+zoneId+"/recordsets", map[string]string{}, maps.Map{
 | 
			
		||||
		"name":        newRecord.Name + "." + domain + ".",
 | 
			
		||||
		"description": "CDN系统自动创建",
 | 
			
		||||
@@ -1376,6 +1382,11 @@ func (this *HuaweiDNSProvider) UpdateRecord(domain string, record *dnstypes.Reco
 | 
			
		||||
		ttl = 300
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 华为云TXT需要加引号
 | 
			
		||||
	if newRecord.Type == dnstypes.RecordTypeTXT {
 | 
			
		||||
		newRecord.Value = "\"" + strings.Trim(newRecord.Value, "\"") + "\""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var resp = new(huaweidns.ZonesUpdateRecordSetResponse)
 | 
			
		||||
	err = this.doAPI(http.MethodPut, "/v2.1/zones/"+zoneId+"/recordsets/"+recordId, map[string]string{}, maps.Map{
 | 
			
		||||
		"name":        newRecord.Name + "." + domain + ".",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user