Skip to content

Commit

Permalink
handle query in signature url
Browse files Browse the repository at this point in the history
  • Loading branch information
ANKUR DWIVEDI authored and ANKUR DWIVEDI committed May 17, 2024
1 parent 3e95f53 commit 5940c2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion url.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (ik *ImageKit) Url(params ikurl.UrlParam) (string, error) {
} else {
if params.TransformationPosition == ikurl.QUERY {
params.QueryParameters["tr"] = joinTransformations(params.Transformations...)
url, err = neturl.Parse(endpoint + params.Path)
url, err = neturl.Parse(strings.TrimRight(endpoint, "/") + "/" + strings.TrimLeft(params.Path, "/"))

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

0 comments on commit 5940c2d

Please sign in to comment.