Returning functional snapshot download link
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
872826c0b1
commit
3120a8c6ee
2 changed files with 13 additions and 1 deletions
|
@ -172,5 +172,8 @@ func (s S3Driver) GetDownloadLink(key string) (string, error) {
|
|||
return "", fmt.Errorf("generating presign URL error: %v", err)
|
||||
}
|
||||
|
||||
return presignedURL.String(), nil
|
||||
if s.S3SSL {
|
||||
return fmt.Sprintf("https://%s%s?%s", s.S3Endpoint, presignedURL.Path, presignedURL.RawQuery), nil
|
||||
}
|
||||
return fmt.Sprintf("http://%s%s?%s", s.S3Endpoint, presignedURL.Path, presignedURL.RawQuery), nil
|
||||
}
|
||||
|
|
|
@ -77,3 +77,12 @@ func TestS3Delete(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.NotContains(t, keys, "testkey")
|
||||
}
|
||||
|
||||
func TestGetDownloadLink(t *testing.T) {
|
||||
err := testS3Driver.Write("testkey", []byte(testContent))
|
||||
assert.Nil(t, err)
|
||||
|
||||
link, err := testS3Driver.GetDownloadLink("testkey")
|
||||
assert.Nil(t, err)
|
||||
assert.Contains(t, link, "/testsnapshots/testkey?X-Amz-Algorithm=AWS4-HMAC-SHA256")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue