s3store: Fix data loss when using deferred upload lengths (#462)
This commit is contained in:
parent
d152c5bbf8
commit
e85d630748
|
@ -895,7 +895,7 @@ func (upload *s3Upload) concatUsingMultipart(ctx context.Context, partialUploads
|
||||||
return upload.FinishUpload(ctx)
|
return upload.FinishUpload(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (upload s3Upload) DeclareLength(ctx context.Context, length int64) error {
|
func (upload *s3Upload) DeclareLength(ctx context.Context, length int64) error {
|
||||||
info, err := upload.GetInfo(ctx)
|
info, err := upload.GetInfo(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -605,6 +605,9 @@ func TestDeclareLength(t *testing.T) {
|
||||||
|
|
||||||
err = store.AsLengthDeclarableUpload(upload).DeclareLength(context.Background(), 500)
|
err = store.AsLengthDeclarableUpload(upload).DeclareLength(context.Background(), 500)
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
|
info, err := upload.GetInfo(context.Background())
|
||||||
|
assert.Nil(err)
|
||||||
|
assert.Equal(int64(500), info.Size)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFinishUpload(t *testing.T) {
|
func TestFinishUpload(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue