mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 18:31:17 +08:00
swift: fix dangling large objects breaking the listing
Before this change, large objects which had had their contents deleted would return "Object not found" and break the listing. This change makes these objects appear as 0 sized entities so they can be listed and deleted.
This commit is contained in:
parent
44ff766f98
commit
db37360a1d
|
@ -505,7 +505,15 @@ func (f *Fs) newObjectWithInfo(remote string, info *swift.Object) (fs.Object, er
|
|||
// 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" {
|
||||
info = nil
|
||||
err := o.readMetaData() // reads info and headers, returning an error
|
||||
if err == fs.ErrorObjectNotFound {
|
||||
// We have a dangling large object here so just return the original metadata
|
||||
fs.Errorf(o, "dangling large object with no contents")
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return o, nil
|
||||
}
|
||||
}
|
||||
if info != nil {
|
||||
// Set info but not headers
|
||||
|
|
Loading…
Reference in New Issue
Block a user