Skip to content

Commit 990f9ac

Browse files
authored
mijnhost: improve record filter (#2562)
1 parent 1fecd31 commit 990f9ac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

providers/dns/mijnhost/mijnhost.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const (
2828
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
2929
)
3030

31+
const txtType = "TXT"
32+
3133
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
3234

3335
// Config is used to configure the creation of the DNSProvider.
@@ -128,7 +130,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
128130
}
129131

130132
record := internal.Record{
131-
Type: "TXT",
133+
Type: txtType,
132134
Name: subDomain,
133135
Value: info.Value,
134136
TTL: d.config.TTL,
@@ -137,7 +139,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
137139
// mijn.host doesn't support multiple values for a domain,
138140
// so we removed existing record for the subdomain.
139141
cleanedRecords := filterRecords(records, func(record internal.Record) bool {
140-
return record.Name == subDomain || record.Name == dns01.UnFqdn(info.EffectiveFQDN)
142+
return record.Type == txtType && (record.Name == subDomain || record.Name == dns01.UnFqdn(info.EffectiveFQDN))
141143
})
142144

143145
cleanedRecords = append(cleanedRecords, record)
@@ -170,7 +172,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
170172
}
171173

172174
cleanedRecords := filterRecords(records, func(record internal.Record) bool {
173-
return record.Value == info.Value
175+
return record.Type == txtType && record.Value == info.Value
174176
})
175177

176178
err = d.client.UpdateRecords(context.Background(), dom.Domain, cleanedRecords)

0 commit comments

Comments
 (0)