mirror of
https://github.com/minio/mc.git
synced 2025-11-12 01:02:26 +03:00
Migrate to PresignedGetObject from PresignedGetPartialObject() as the latter was of no real use
This commit is contained in:
@@ -72,7 +72,6 @@ type ObjectAPI interface {
|
||||
// PresignedAPI - object specific for now
|
||||
type PresignedAPI interface {
|
||||
PresignedGetObject(bucket, object string, expires time.Duration) (string, error)
|
||||
PresignedGetPartialObject(bucket, object string, expires time.Duration, offset, length int64) (string, error)
|
||||
}
|
||||
|
||||
// BucketStatCh - bucket metadata over read channel
|
||||
@@ -235,14 +234,6 @@ func (a apiV2) PresignedGetObject(bucket, object string, expires time.Duration)
|
||||
return a.presignedGetObject(bucket, object, expireSeconds, 0, 0)
|
||||
}
|
||||
|
||||
func (a apiV2) PresignedGetPartialObject(bucket, object string, expires time.Duration, offset, length int64) (string, error) {
|
||||
expireSeconds := int64(expires / time.Second)
|
||||
if expireSeconds < 1 || expireSeconds > 604800 {
|
||||
return "", invalidArgumentError("")
|
||||
}
|
||||
return a.presignedGetObject(bucket, object, expireSeconds, offset, length)
|
||||
}
|
||||
|
||||
// GetObject retrieve object
|
||||
|
||||
// Downloads full object with no ranges, if you need ranges use GetPartialObject
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"canonical": "github.com/dustin/go-humanize",
|
||||
"comment": "",
|
||||
"local": "github.com/dustin/go-humanize",
|
||||
"revision": "555c9466709dddbb3933eb22815b1abf7f6f869f",
|
||||
"revisionTime": "2015-08-20T20:35:45-07:00"
|
||||
"revision": "5721d85c9a0e65ee65005e7da48c56612ae04ee3",
|
||||
"revisionTime": "2015-08-20T22:35:37-07:00"
|
||||
},
|
||||
{
|
||||
"canonical": "github.com/fatih/color",
|
||||
@@ -20,8 +20,8 @@
|
||||
"canonical": "github.com/fatih/structs",
|
||||
"comment": "",
|
||||
"local": "github.com/fatih/structs",
|
||||
"revision": "555c9466709dddbb3933eb22815b1abf7f6f869f",
|
||||
"revisionTime": "2015-08-20T20:35:45-07:00"
|
||||
"revision": "5721d85c9a0e65ee65005e7da48c56612ae04ee3",
|
||||
"revisionTime": "2015-08-20T22:35:37-07:00"
|
||||
},
|
||||
{
|
||||
"canonical": "github.com/mattn/go-isatty",
|
||||
@@ -41,22 +41,22 @@
|
||||
"canonical": "github.com/minio/minio-go",
|
||||
"comment": "",
|
||||
"local": "github.com/minio/minio-go",
|
||||
"revision": "feda9e7303c21b33793ce0f8105e8884b5eee6b1",
|
||||
"revisionTime": "2015-08-17T20:55:25-07:00"
|
||||
"revision": "d3dc9fd261cacbe64e4c0e5f3929e1fb846db42b",
|
||||
"revisionTime": "2015-08-21T20:20:57-07:00"
|
||||
},
|
||||
{
|
||||
"canonical": "github.com/minio/minio/pkg/probe",
|
||||
"comment": "",
|
||||
"local": "github.com/minio/minio/pkg/probe",
|
||||
"revision": "555c9466709dddbb3933eb22815b1abf7f6f869f",
|
||||
"revisionTime": "2015-08-20T20:35:45-07:00"
|
||||
"revision": "5721d85c9a0e65ee65005e7da48c56612ae04ee3",
|
||||
"revisionTime": "2015-08-20T22:35:37-07:00"
|
||||
},
|
||||
{
|
||||
"canonical": "github.com/minio/minio/pkg/quick",
|
||||
"comment": "",
|
||||
"local": "github.com/minio/minio/pkg/quick",
|
||||
"revision": "555c9466709dddbb3933eb22815b1abf7f6f869f",
|
||||
"revisionTime": "2015-08-20T20:35:45-07:00"
|
||||
"revision": "5721d85c9a0e65ee65005e7da48c56612ae04ee3",
|
||||
"revisionTime": "2015-08-20T22:35:37-07:00"
|
||||
},
|
||||
{
|
||||
"canonical": "github.com/minio/pb",
|
||||
|
||||
@@ -35,7 +35,7 @@ type Client interface {
|
||||
SetBucketACL(acl string) *probe.Error
|
||||
|
||||
// Object operations
|
||||
Share(expires time.Duration, offset, length int64) (string, *probe.Error)
|
||||
Share(expires time.Duration) (string, *probe.Error)
|
||||
GetObject(offset, length int64) (body io.ReadCloser, size int64, err *probe.Error)
|
||||
PutObject(size int64, data io.Reader) *probe.Error
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ func (f *fsClient) get() (io.ReadCloser, int64, *probe.Error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fsClient) Share(expires time.Duration, offset, length int64) (string, *probe.Error) {
|
||||
func (f *fsClient) Share(expires time.Duration) (string, *probe.Error) {
|
||||
return "", probe.NewError(client.APINotImplemented{API: "Share", APIType: "filesystem"})
|
||||
}
|
||||
|
||||
|
||||
@@ -102,9 +102,9 @@ func (c *s3Client) GetObject(offset, length int64) (io.ReadCloser, int64, *probe
|
||||
}
|
||||
|
||||
// Share - get a usable get object url to share
|
||||
func (c *s3Client) Share(expires time.Duration, offset, length int64) (string, *probe.Error) {
|
||||
func (c *s3Client) Share(expires time.Duration) (string, *probe.Error) {
|
||||
bucket, object := c.url2BucketAndObject()
|
||||
presignedURL, err := c.api.PresignedGetPartialObject(bucket, object, expires, offset, length)
|
||||
presignedURL, err := c.api.PresignedGetObject(bucket, object, expires)
|
||||
if err != nil {
|
||||
return "", probe.NewError(err)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func doShareCmd(targetURL string, recursive bool, expires time.Duration) *probe.
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
}
|
||||
presignedURL, err := newClnt.Share(expires, 0, 0)
|
||||
presignedURL, err := newClnt.Share(expires)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user