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

b2: fix html files downloaded via cloudflare

Nick Craig-Woodd042f3194f4f
diff --git a/backend/b2/b2.go b/backend/b2/b2.go
index b5690a99e..eccb06441 100644
--- a/backend/b2/b2.go
+++ b/backend/b2/b2.go
@@ -1744,6 +1744,13 @@ func (o *Object) getOrHead(ctx context.Context, method string, options []fs.Open
ContentType: resp.Header.Get("Content-Type"),
Info: Info,
}
+ // When reading files from B2 via cloudflare using
+ // --b2-download-url cloudflare strips the Content-Length
+ // headers (presumably so it can inject stuff) so use the old
+ // length read from the listing.
+ if info.Size < 0 {
+ info.Size = o.size
+ }
return resp, info, nil
}