Skip to content

Commit

Permalink
Fix: local
Browse files Browse the repository at this point in the history
  • Loading branch information
duxphp committed Nov 4, 2024
1 parent c43731f commit 913cb6e
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions drivers/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,30 @@ func (s *LocalStorage) SignPostUrl(ctx context.Context, path string) (url string

return url, map[string]string{
"sign": sign,
"key": path,
}, nil
}

func (s *LocalStorage) SignPutUrl(ctx context.Context, path string) (url string, err error) {
url = s.getUploadPath(path)
func (s *LocalStorage) SignPutUrl(ctx context.Context, path string) (string, error) {
u := s.getUploadPath(path)

sign, err := s.getSign(path)
sign, err := s.getSign(u)
if err != nil {
return url, err
return "", err
}
if strings.Contains(url, "?") {
url = url + "&sign=" + sign

params := url.Values{}
params.Add("sign", sign)
params.Add("key", path)

q := params.Encode()

if strings.Contains(u, "?") {
u = u + "&sign=" + q
} else {
url = url + "?sign=" + sign
u = u + "?sign=" + q
}
return url, nil
return u, nil
}

func (s *LocalStorage) getUploadPath(path string) string {
Expand Down

0 comments on commit 913cb6e

Please sign in to comment.