mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 15:11:56 +01:00
swift: fix HEADing 0-length objects when --swift-no-large-objects set
The Swift backend does not always respect the flag telling it to skip HEADing zero-length objects. This commit fixes that for ls/lsl/lsf. Swift returns zero length for dynamic large object files when they're included in a files lookup, which means that determining their size requires HEADing each file that returns a size of zero. rclone's --swift-no-large-objects instructs rclone that no large objects are present and accordingly rclone should not HEAD files that return zero length. When rclone is performing an ls / lsf / lsl type lookup, however, it continues to HEAD any zero length objects it encounters, even with this flag set. Accordingly, this change causes rclone to respect the flag in these situations. NB: It is worth noting that this will cause rclone to incorrectly report zero length for any dynamic large objects encountered with the --swift-no-large-objects flag set.
This commit is contained in:
parent
91d095f468
commit
9f96c0d4ea
@ -561,7 +561,7 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *swift.O
|
||||
// returned as 0 bytes in the listing. Correct this here by
|
||||
// making sure we read the full metadata for all 0 byte files.
|
||||
// We don't read the metadata for directory marker objects.
|
||||
if info != nil && info.Bytes == 0 && info.ContentType != "application/directory" {
|
||||
if info != nil && info.Bytes == 0 && info.ContentType != "application/directory" && !o.fs.opt.NoLargeObjects {
|
||||
err := o.readMetaData(ctx) // reads info and headers, returning an error
|
||||
if err == fs.ErrorObjectNotFound {
|
||||
// We have a dangling large object here so just return the original metadata
|
||||
|
Loading…
Reference in New Issue
Block a user