Revert "MM-43828: Pass object length for some image operations (#20711)" (#20740)

Automatic Merge
Этот коммит содержится в:
Agniva De Sarker
2022-07-29 20:23:14 +05:30
коммит произвёл GitHub
родитель 562388501e
Коммит c7ae090dad
7 изменённых файлов: 175 добавлений и 30 удалений

Просмотреть файл

@@ -4,7 +4,6 @@
package filestore
import (
"bytes"
"context"
"crypto/tls"
"io"
@@ -366,13 +365,7 @@ func (b *S3FileBackend) WriteFile(fr io.Reader, path string) (int64, error) {
ctx, cancel := context.WithTimeout(context.Background(), b.timeout)
defer cancel()
options := s3PutOptions(b.encrypt, contentType)
objSize := -1
if buf, ok := fr.(*bytes.Buffer); ok {
objSize = buf.Len()
}
info, err := b.client.PutObject(ctx, b.bucket, path, fr, int64(objSize), options)
info, err := b.client.PutObject(ctx, b.bucket, path, fr, -1, options)
if err != nil {
return info.Size, errors.Wrapf(err, "unable write the data in the file %s", path)
}
@@ -400,11 +393,7 @@ func (b *S3FileBackend) AppendFile(fr io.Reader, path string) (int64, error) {
partName := fp + ".part"
ctx2, cancel2 := context.WithTimeout(context.Background(), b.timeout)
defer cancel2()
objSize := -1
if buf, ok := fr.(*bytes.Buffer); ok {
objSize = buf.Len()
}
info, err := b.client.PutObject(ctx2, b.bucket, partName, fr, int64(objSize), options)
info, err := b.client.PutObject(ctx2, b.bucket, partName, fr, -1, options)
if err != nil {
return 0, errors.Wrapf(err, "unable append the data in the file %s", path)
}