mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-03-31 06:24:00 -04:00
fix(porkbun): fix wildcard behavior (#773)
This commit is contained in:
@@ -20,9 +20,6 @@ func (p *Provider) getRecordIDs(ctx context.Context, client *http.Client, record
|
||||
Host: "porkbun.com",
|
||||
Path: "/api/json/v3/dns/retrieveByNameType/" + p.domain + "/" + recordType + "/",
|
||||
}
|
||||
if p.owner != "@" && p.owner != "*" {
|
||||
u.Path += p.owner
|
||||
}
|
||||
|
||||
postRecordsParams := struct {
|
||||
SecretAPIKey string `json:"secretapikey"`
|
||||
@@ -38,7 +35,14 @@ func (p *Provider) getRecordIDs(ctx context.Context, client *http.Client, record
|
||||
return nil, fmt.Errorf("json encoding request data: %w", err)
|
||||
}
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, u.String(), buffer)
|
||||
encodedRequestURL := u.String()
|
||||
if p.owner != "@" {
|
||||
// add owner after string-ing the URL to avoid encoding the '*' character,
|
||||
// since Porkbun requires we send the unencoded '*' character.
|
||||
encodedRequestURL += p.owner
|
||||
}
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, encodedRequestURL, buffer)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("creating http request: %w", err)
|
||||
}
|
||||
@@ -173,14 +177,11 @@ func (p *Provider) updateRecord(ctx context.Context, client *http.Client,
|
||||
|
||||
// See https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Records%20by%20Domain,%20Subdomain%20and%20Type
|
||||
func (p *Provider) deleteAliasRecord(ctx context.Context, client *http.Client) (err error) {
|
||||
var subdomain string
|
||||
if p.owner != "@" {
|
||||
subdomain = p.owner
|
||||
}
|
||||
u := url.URL{
|
||||
Scheme: "https",
|
||||
Host: "porkbun.com",
|
||||
Path: "/api/json/v3/dns/deleteByNameType/" + p.domain + "/ALIAS/" + subdomain,
|
||||
// owner is added below after string-ing the URL
|
||||
Path: "/api/json/v3/dns/deleteByNameType/" + p.domain + "/ALIAS/",
|
||||
}
|
||||
postRecordsParams := struct {
|
||||
SecretAPIKey string `json:"secretapikey"`
|
||||
@@ -196,7 +197,14 @@ func (p *Provider) deleteAliasRecord(ctx context.Context, client *http.Client) (
|
||||
return fmt.Errorf("json encoding request data: %w", err)
|
||||
}
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, u.String(), buffer)
|
||||
encodedRequestURL := u.String()
|
||||
if p.owner != "@" {
|
||||
// add owner after string-ing the URL to avoid encoding the '*' character,
|
||||
// since Porkbun requires we send the unencoded '*' character.
|
||||
encodedRequestURL += p.owner
|
||||
}
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, encodedRequestURL, buffer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating http request: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user