1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Nick Craig-Wood
53bbe891d3 lib/rest: retry errors due to failed JSON decoding - fixes #8383
These errors are almost always caused by an overloaded proxy somewhere
in the chain returning HTML so they are worth retrying.
2025-02-14 14:47:09 +00:00
Nick Craig-Wood
4aaef7472d docs: add FileLu as sponsors and tidy sponsor logos 2025-02-14 12:33:26 +00:00
3 changed files with 11 additions and 3 deletions

View File

@@ -57,7 +57,8 @@ off donation.
Thank you very much to our sponsors:
{{< sponsor src="/img/logos/idrive_e2.svg" width="300" height="200" title="Visit our sponsor IDrive e2" link="https://www.idrive.com/e2/?refer=rclone">}}
{{< sponsor src="/img/logos/warp.svg" width="300" height="200" title="Visit our sponsor warp.dev" link="https://www.warp.dev/?utm_source=rclone&utm_medium=referral&utm_campaign=rclone_20231103">}}
{{< sponsor src="/img/logos/warp.svg" width="285" height="200" title="Visit our sponsor warp.dev" link="https://www.warp.dev/?utm_source=rclone&utm_medium=referral&utm_campaign=rclone_20231103">}}
{{< sponsor src="/img/logos/sia.svg" width="200" height="200" title="Visit our sponsor sia" link="https://sia.tech">}}
{{< sponsor src="/img/logos/route4me.svg" width="400" height="200" title="Visit our sponsor Route4Me" link="https://route4me.com/">}}
{{< sponsor src="/img/logos/rcloneview.svg" width="300" height="200" title="Visit our sponsor RcloneView" link="https://rcloneview.com/">}}
{{< sponsor src="/img/logos/filelu-rclone.svg" width="330" height="200" title="Visit our sponsor FileLu" link="https://filelu.com/">}}

View File

@@ -1,3 +1,3 @@
<a href="{{ .Get "link" }}" target="_blank" >
<img width="{{ .Get "width" }}" src="{{ .Get "src" }}" title="{{ .Get "title" }}" style="{{ .Get "style" | safeCSS }}">
<img width="{{ .Get "width" }}" src="{{ .Get "src" }}" title="{{ .Get "title" }}" styleX="{{ .Get "style" | safeCSS }}" style="margin: 2px; padding: 1px; border: 1px solid #ddd; border-radius: 4px;">
</a>

View File

@@ -17,6 +17,7 @@ import (
"sync"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/fserrors"
"github.com/rclone/rclone/lib/readers"
)
@@ -189,7 +190,13 @@ func checkDrainAndClose(r io.ReadCloser, err *error) {
func DecodeJSON(resp *http.Response, result interface{}) (err error) {
defer checkDrainAndClose(resp.Body, &err)
decoder := json.NewDecoder(resp.Body)
return decoder.Decode(result)
err = decoder.Decode(result)
if err != nil {
// Retry this as it is likely some overloaded server sending HTML instead of JSON
contentType := resp.Header.Get("Content-Type")
err = fserrors.RetryError(fmt.Errorf("failed to decode JSON from Content-Type: %q: %v", contentType, err))
}
return err
}
// DecodeXML decodes resp.Body into result