From f635eb8db785ba5cdd4d36893527600bd4a9f271 Mon Sep 17 00:00:00 2001 From: ddxyq <657023321@qq.com> Date: Fri, 13 Dec 2024 23:01:49 +0800 Subject: [PATCH] fix signature error while the content includes @ (#646) * fix signature error while the content includes @ * impore strings * add comment for this change in code * fix comments --- v2/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/v2/client.go b/v2/client.go index 6ac71f00..90faa0cd 100644 --- a/v2/client.go +++ b/v2/client.go @@ -11,6 +11,7 @@ import ( "net/http" "net/url" "os" + "strings" "time" "github.com/bitly/go-simplejson" @@ -440,8 +441,12 @@ func (c *Client) parseRequest(r *request, opts ...RequestOption) (err error) { r.setParam(timestampKey, currentTimestamp()-c.TimeOffset) } queryString := r.query.Encode() + // @ is a safe character and does not require escape, So replace it back. + queryString = strings.ReplaceAll(queryString, "%40", "@") body := &bytes.Buffer{} bodyString := r.form.Encode() + // @ is a safe character and does not require escape, So replace it back. + bodyString = strings.ReplaceAll(bodyString, "%40", "@") header := http.Header{} if r.header != nil { header = r.header.Clone()