From 41dd13dc7e25eb2a8c201da23d18496087eccb4a Mon Sep 17 00:00:00 2001 From: Ferdinando Formica Date: Wed, 2 Oct 2024 10:55:34 +0100 Subject: [PATCH] Expand allowed redirect targets character set (#330) --- CHANGELOG.md | 3 +++ ns1/config.go | 2 +- ns1/resource_redirect.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceefe433..569473fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.4.3 (October 2, 2024) +* Modified target regex for redirects to align with server + ## 2.4.2 (September 16, 2024) * Modified domain regex for redirects to allow internationalised domains diff --git a/ns1/config.go b/ns1/config.go index d622c0e6..97fde122 100644 --- a/ns1/config.go +++ b/ns1/config.go @@ -19,7 +19,7 @@ import ( ) var ( - clientVersion = "2.4.2" + clientVersion = "2.4.3" providerUserAgent = "tf-ns1" + "/" + clientVersion defaultRetryMax = 3 ) diff --git a/ns1/resource_redirect.go b/ns1/resource_redirect.go index 1ac23151..185497d3 100644 --- a/ns1/resource_redirect.go +++ b/ns1/resource_redirect.go @@ -370,7 +370,7 @@ func validatePath(val interface{}, key string) (warns []string, errs []error) { func validateURL(val interface{}, key string) (warns []string, errs []error) { v := val.(string) - match, err := regexp.MatchString("^(http://|https://)?[a-zA-Z0-9\\-\\.]+(:\\d+)?(/[a-zA-Z0-9\\.\\-/_~%%:]*)?(\\?[a-zA-Z0-9\\.\\-/_~%%=+&#]+)?(#[a-zA-Z0-9\\.\\-/_~%%]+)?$", v) + match, err := regexp.MatchString("^(http://|https://)?[a-zA-Z0-9\\-\\.]+(:\\d+)?(/[a-zA-Z0-9\\.\\-/_~%%:$&()*+,;=@!]*)?(\\?[a-zA-Z0-9\\.\\-/_~%%:$&()*+,;=@!]*)?(#[a-zA-Z0-9\\.\\-/_~%%:$&()*+,;=@!?]+)?$", v) if err != nil { errs = append(errs, fmt.Errorf("%s is invalid, got: %s, error: %e", key, v, err)) }