修复华为云DNS TXT记录值不加引号无法添加的问题

This commit is contained in:
GoEdgeLab
2021-10-13 17:53:14 +08:00
parent de84a054fd
commit 8bd967db3a

View File

@@ -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 + ".",