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

swift: fix dangling large objects breaking the listing

Nick Craig-Wooddb37360a1d84
diff --git a/backend/swift/swift.go b/backend/swift/swift.go
index c94b79822..8549519b5 100644
--- a/backend/swift/swift.go
+++ b/backend/swift/swift.go
@@ -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