From 20f31c6be4a65def64be865f3bca04963aab54de Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Thu, 17 Aug 2023 12:31:21 -0700 Subject: [PATCH] fix : Signed-off-by: Jess Frazelle --- VERSION.txt | 2 +- cmd/utils.go | 2 ++ cmd/utils_test.go | 8 ++++++++ utils.go | 2 ++ utils_test.go | 8 ++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index c096d8a..37c46a5 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -v0.2.24 +v0.2.25 diff --git a/cmd/utils.go b/cmd/utils.go index 37678c5..97c6c52 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -59,6 +59,8 @@ func expandURL(u *url.URL, expansions map[string]string) error { // Set the path parameters u.RawQuery = values.Encode() + // We want colons in the query string to be unescaped. + u.RawQuery = strings.Replace(u.RawQuery, "%253A", ":", -1) return nil } diff --git a/cmd/utils_test.go b/cmd/utils_test.go index f20463e..74d1bc1 100644 --- a/cmd/utils_test.go +++ b/cmd/utils_test.go @@ -39,6 +39,14 @@ func TestExpandURL(t *testing.T) { }, testServerURL + "/file/convert?outputFormat=obj&srcFormat=step", }, + // Path params added as extras. + { + "file/mass", + map[string]string{ + "unit": "kg:m3", + }, + testServerURL + "/file/mass?unit=kg:m3", + }, } for i, test := range expandTests { diff --git a/utils.go b/utils.go index 1269db9..3cc57bb 100644 --- a/utils.go +++ b/utils.go @@ -59,6 +59,8 @@ func expandURL(u *url.URL, expansions map[string]string) error { // Set the path parameters u.RawQuery = values.Encode() + // We want colons in the query string to be unescaped. + u.RawQuery = strings.Replace(u.RawQuery, "%253A", ":", -1) return nil } diff --git a/utils_test.go b/utils_test.go index 92f2ca9..84a7f1f 100644 --- a/utils_test.go +++ b/utils_test.go @@ -39,6 +39,14 @@ func TestExpandURL(t *testing.T) { }, testServerURL + "/file/convert?outputFormat=obj&srcFormat=step", }, + // Path params added as extras. + { + "file/mass", + map[string]string{ + "unit": "kg:m3", + }, + testServerURL + "/file/mass?unit=kg:m3", + }, } for i, test := range expandTests {