From 8bd967db3a32f4790e81e8c4915c467f5e67dc49 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 13 Oct 2021 17:53:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=8E=E4=B8=BA=E4=BA=91DN?= =?UTF-8?q?S=20TXT=E8=AE=B0=E5=BD=95=E5=80=BC=E4=B8=8D=E5=8A=A0=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E6=97=A0=E6=B3=95=E6=B7=BB=E5=8A=A0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dnsclients/provider_huawei_dns.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/dnsclients/provider_huawei_dns.go b/internal/dnsclients/provider_huawei_dns.go index 240d3548..dc80af10 100644 --- a/internal/dnsclients/provider_huawei_dns.go +++ b/internal/dnsclients/provider_huawei_dns.go @@ -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 + ".",