Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Fix crash in http logging - fixes #223

Nick Craig-Wood8057d668bb09
diff --git a/fs/loghttp.go b/fs/loghttp.go
index 4c6f868e4..81ed02061 100644
--- a/fs/loghttp.go
+++ b/fs/loghttp.go
@@ -48,10 +48,14 @@ func (t *LoggedTransport) RoundTrip(req *http.Request) (resp *http.Response, err
log.Println(string(buf))
log.Println(separatorReq)
resp, err = t.wrapped.RoundTrip(req)
- buf, _ = httputil.DumpResponse(resp, t.logBody)
log.Println(separatorResp)
log.Println("HTTP RESPONSE")
- log.Println(string(buf))
+ if err != nil {
+ log.Printf("Error: %v\n", err)
+ } else {
+ buf, _ = httputil.DumpResponse(resp, t.logBody)
+ log.Println(string(buf))
+ }
log.Println(separatorResp)
return resp, err
}