fix: if we get an ErrUnexpectedEOF due to being less than512 bytes, read it all instead

This commit is contained in:
Derrick Hammer 2024-03-02 04:45:09 -05:00
parent 8a112a8c12
commit a9c2ecade0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 1 deletions

View File

@ -174,7 +174,16 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag
}
_, err = io.ReadFull(reader, mimeBytes)
if err != nil {
return nil, err
if !errors.Is(err, io.ErrUnexpectedEOF) {
return nil, err
}
reader, err = getReader()
if err != nil {
return nil, err
}
mimeBytes, err = io.ReadAll(reader)
}
reader, err = getReader()