Skip to content

Commit 5940c2d

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
handle query in signature url
1 parent 3e95f53 commit 5940c2d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

url.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (ik *ImageKit) Url(params ikurl.UrlParam) (string, error) {
4444
} else {
4545
if params.TransformationPosition == ikurl.QUERY {
4646
params.QueryParameters["tr"] = joinTransformations(params.Transformations...)
47-
url, err = neturl.Parse(endpoint + params.Path)
47+
url, err = neturl.Parse(strings.TrimRight(endpoint, "/") + "/" + strings.TrimLeft(params.Path, "/"))
4848

4949
} else {
5050
url, err = neturl.Parse(url.String() +
@@ -90,6 +90,7 @@ func (ik *ImageKit) Url(params ikurl.UrlParam) (string, error) {
9090
expires = strconv.Itoa(DEFAULT_TIMESTAMP)
9191
}
9292
var path = strings.Replace(resultUrl, endpoint, "", 1)
93+
path = strings.TrimPrefix(path, "/")
9394
path = path + expires
9495
mac := hmac.New(sha1.New, []byte(ik.Config.Cloud.PrivateKey))
9596
mac.Write([]byte(path))

0 commit comments

Comments
 (0)