s3store: Fix data loss when using deferred upload lengths (#462)

This commit is contained in:
Adam Jensen 2021-03-11 12:17:47 -05:00 committed by GitHub
parent d152c5bbf8
commit e85d630748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -895,7 +895,7 @@ func (upload *s3Upload) concatUsingMultipart(ctx context.Context, partialUploads
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)
if err != nil {
return err

View File

@ -605,6 +605,9 @@ func TestDeclareLength(t *testing.T) {
err = store.AsLengthDeclarableUpload(upload).DeclareLength(context.Background(), 500)
assert.Nil(err)
info, err := upload.GetInfo(context.Background())
assert.Nil(err)
assert.Equal(int64(500), info.Size)
}
func TestFinishUpload(t *testing.T) {