mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
b2: fix html files downloaded via cloudflare
When reading files from B2 via cloudflare using --b2-download-url cloudflare strips the Content-Length headers (presumably so it can inject stuff into the body). This caused rclone to think the file was corrupted as the length didn't match. The patch uses the old length read from the listing if there is no Content-Length. See: https://forum.rclone.org/t/b2-cloudflare-error-directory-not-found/23026
This commit is contained in:
parent
524cd327e6
commit
d042f3194f
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user