fix(seafile): driver panic while downloading or uploading file (#4491)

Co-authored-by: Andy Hsu <i@nn.ci>
This commit is contained in:
KAAAsS 2023-05-28 16:45:46 +08:00 committed by GitHub
parent a80e21997c
commit 8421c72c5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,11 +36,14 @@ func (d *Seafile) request(method string, pathname string, callback base.ReqCallb
if len(noRedirect) > 0 && noRedirect[0] {
req = base.NoRedirectClient.R()
}
var res resty.Response
req.SetHeader("Authorization", d.authorization)
callback(req)
var (
res *resty.Response
err error
)
for i := 0; i < 2; i++ {
req.SetHeader("Authorization", d.authorization)
callback(req)
res, err := req.Execute(method, full)
res, err = req.Execute(method, full)
if err != nil {
return nil, err
}