fix: if we get an ErrUnexpectedEOF due to being less than512 bytes, read it all instead
This commit is contained in:
parent
8a112a8c12
commit
a9c2ecade0
|
@ -174,6 +174,7 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag
|
|||
}
|
||||
_, err = io.ReadFull(reader, mimeBytes)
|
||||
if err != nil {
|
||||
if !errors.Is(err, io.ErrUnexpectedEOF) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -182,6 +183,14 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag
|
|||
return nil, err
|
||||
}
|
||||
|
||||
mimeBytes, err = io.ReadAll(reader)
|
||||
}
|
||||
|
||||
reader, err = getReader()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mimeType := http.DetectContentType(mimeBytes)
|
||||
|
||||
protocolName := protocol.Name()
|
||||
|
|
Loading…
Reference in New Issue