fix: handle both when IsError is true and when we have an error object

This commit is contained in:
Derrick Hammer 2024-01-16 01:36:19 -05:00
parent d017b0741c
commit aa2ee9eee2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package storage
import (
"bytes"
"encoding/hex"
"errors"
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
"git.lumeweb.com/LumeWeb/portal/db/models"
"git.lumeweb.com/LumeWeb/portal/interfaces"
@ -58,10 +59,15 @@ func (s StorageServiceImpl) PutFile(file io.ReadSeeker, bucket string, generateP
s.portal.Logger().Info("resp", zap.Any("resp", resp.String()))
if resp.IsError() && resp.Error() != nil {
if resp.IsError() {
if resp.Error() != nil {
return nil, resp.Error().(error)
}
return nil, errors.New(resp.String())
}
return hash[:], nil
}