mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 01:46:31 +02:00
googlephotos,onedrive: fix crash on error response - fixes #3491
This fixes a crash on the google photos backend when an error is returned from the rest.Call function. This turned out to be a mis-understanding of the rest docs so - improved rest.Call docs - fixed mis-understanding in google photos backend - fixed similar mis-understading in onedrive backend
This commit is contained in:
@@ -46,7 +46,7 @@ func ReadBody(resp *http.Response) (result []byte, err error) {
|
||||
}
|
||||
|
||||
// defaultErrorHandler doesn't attempt to parse the http body, just
|
||||
// returns it in the error message
|
||||
// returns it in the error message closing resp.Body
|
||||
func defaultErrorHandler(resp *http.Response) (err error) {
|
||||
body, err := ReadBody(resp)
|
||||
if err != nil {
|
||||
@@ -178,9 +178,11 @@ func ClientWithNoRedirects(c *http.Client) *http.Client {
|
||||
|
||||
// Call makes the call and returns the http.Response
|
||||
//
|
||||
// if err != nil then resp.Body will need to be closed unless
|
||||
// if err == nil then resp.Body will need to be closed unless
|
||||
// opt.NoResponse is set
|
||||
//
|
||||
// if err != nil then resp.Body will have been closed
|
||||
//
|
||||
// it will return resp if at all possible, even if err is set
|
||||
func (api *Client) Call(opts *Opts) (resp *http.Response, err error) {
|
||||
api.mu.RLock()
|
||||
|
Reference in New Issue
Block a user