@@ -73,7 +73,7 @@ func getStackitRecordSetPayload(change *endpoint.Endpoint) stackitdnsclient.Crea
7373 for i := range change .Targets {
7474 content := change .Targets [i ]
7575
76- if change .RecordType == "TXT" {
76+ if change .RecordType == txtRecord {
7777 content = formatTXTContent (content )
7878 }
7979
@@ -96,7 +96,7 @@ func getStackitPartialUpdateRecordSetPayload(change *endpoint.Endpoint) stackitd
9696 for i := range change .Targets {
9797 content := change .Targets [i ]
9898
99- if change .RecordType == "TXT" {
99+ if change .RecordType == txtRecord {
100100 content = formatTXTContent (content )
101101 }
102102
@@ -139,7 +139,7 @@ func safeTTLToInt32(ttl endpoint.TTL) *int32 {
139139 return & v
140140}
141141
142- // formatTXTContent splits long TXT records into 255-character chunks separated by spaces
142+ // formatTXTContent splits long TXT records into 255-character chunks separated by spaces.
143143func formatTXTContent (content string ) string {
144144 cleanContent := strings .Trim (content , "\" " )
145145
@@ -159,12 +159,13 @@ func formatTXTContent(content string) string {
159159 return strings .Join (chunks , " " )
160160}
161161
162- // unformatTXTContent reverses the DNS chunking and quoting process
162+ // unformatTXTContent reverses the DNS chunking and quoting process.
163163func unformatTXTContent (content string ) string {
164164 if ! strings .HasPrefix (content , "\" " ) || ! strings .HasSuffix (content , "\" " ) {
165165 return content
166166 }
167167
168168 trimmed := content [1 : len (content )- 1 ]
169+
169170 return strings .ReplaceAll (trimmed , `" "` , "" )
170171}
0 commit comments