dnscontrol/pkg/rtypecontrol/stringify.go
Tom Limoncelli f7c145a54c
BUGFIX: Multiple bugs in RP (RecordConfig v2) (#3931)
# Issue

Fixes https://github.com/StackExchange/dnscontrol/issues/3918

New "modern" types like RP had multiple bugs:
* When RP() has an error (for example, wrong # of arguments) no error
was printed.
* DefaultTTL() was ignored.
* FQDNs listed in RP() not properly checked to verify the are part of
the D()/D_EXTEND() domain.
* REFACTOR: Implement "double domain" checking and the skip_fqdn_check
override (instead of in validate.go).
* REFACTOR: Always list "names" as Raw, then ASCII, then Unicode.
* REFACTOR: Generate domain DisplayName once, use many places

# Resolution

Fixed and test-cases added to prevent regressions.
2025-12-18 07:00:38 -05:00

19 lines
298 B
Go

package rtypecontrol
import (
"fmt"
"strings"
)
func StringifyQuoted(args []any) string {
if len(args) == 0 {
return ""
}
var sb strings.Builder
sb.WriteString(fmt.Sprintf("%q", args[0]))
for _, arg := range args[1:] {
sb.WriteString(fmt.Sprintf(" %q", arg))
}
return sb.String()
}