fix oss: got 403 in TestContinueStreamAppendLarge
Signed-off-by: tgic <farmer1992@gmail.com>
This commit is contained in:
parent
9627c6c5a5
commit
2a8535626f
3 changed files with 10 additions and 6 deletions
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
|
@ -46,11 +46,11 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/denverdino/aliyungo/oss",
|
||||
"Rev": "641bb4f0ddb552750324cb54c0140ca08865abd0"
|
||||
"Rev": "0e0f322d0a54b994dea9d32541050d177edf6aa3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/denverdino/aliyungo/util",
|
||||
"Rev": "641bb4f0ddb552750324cb54c0140ca08865abd0"
|
||||
"Rev": "0e0f322d0a54b994dea9d32541050d177edf6aa3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/docker/docker/pkg/tarsum",
|
||||
|
|
8
Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/multi.go
generated
vendored
8
Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/multi.go
generated
vendored
|
@ -139,6 +139,9 @@ func (b *Bucket) InitMulti(key string, contType string, perm ACL, options Option
|
|||
}
|
||||
|
||||
func (m *Multi) PutPartCopy(n int, options CopyOptions, source string) (*CopyObjectResult, Part, error) {
|
||||
// TODO source format a /BUCKET/PATH/TO/OBJECT
|
||||
// TODO not a good design. API could be changed to PutPartCopyWithinBucket(..., path) and PutPartCopyFromBucket(bucket, path)
|
||||
|
||||
headers := make(http.Header)
|
||||
headers.Set("x-oss-copy-source", source)
|
||||
|
||||
|
@ -150,8 +153,9 @@ func (m *Multi) PutPartCopy(n int, options CopyOptions, source string) (*CopyObj
|
|||
sourceBucket := m.Bucket.Client.Bucket(strings.TrimRight(strings.Split(source, "/")[1], "/"))
|
||||
//log.Println("source: ", source)
|
||||
//log.Println("sourceBucket: ", sourceBucket.Name)
|
||||
//log.Println("HEAD: ", strings.Split(source, "/")[2])
|
||||
sourceMeta, err := sourceBucket.Head(strings.Split(source, "/")[2], nil)
|
||||
//log.Println("HEAD: ", strings.strings.SplitAfterN(source, "/", 3)[2])
|
||||
// TODO SplitAfterN can be use in bucket name
|
||||
sourceMeta, err := sourceBucket.Head(strings.SplitAfterN(source, "/", 3)[2], nil)
|
||||
if err != nil {
|
||||
return nil, Part{}, err
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ func (d *driver) WriteStream(ctx context.Context, path string, offset int64, rea
|
|||
// currentLength >= offset >= chunkSize
|
||||
_, part, err = multi.PutPartCopy(partNumber,
|
||||
oss.CopyOptions{CopySourceOptions: "bytes=0-" + strconv.FormatInt(offset-1, 10)},
|
||||
d.Bucket.Name+"/"+d.ossPath(path))
|
||||
d.Bucket.Path(d.ossPath(path)))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ func (d *driver) WriteStream(ctx context.Context, path string, offset int64, rea
|
|||
// offset > currentLength >= chunkSize
|
||||
_, part, err = multi.PutPartCopy(partNumber,
|
||||
oss.CopyOptions{},
|
||||
d.Bucket.Name+"/"+d.ossPath(path))
|
||||
d.Bucket.Path(d.ossPath(path)))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue