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 update multipart object removing all of its own parts

Nick Craig-Wood324077fb48ec
diff --git a/backend/swift/swift.go b/backend/swift/swift.go
index 761b8f9c8..c44b7feec 100644
--- a/backend/swift/swift.go
+++ b/backend/swift/swift.go
@@ -1115,13 +1115,18 @@ func min(x, y int64) int64 {
//
// if except is passed in then segments with that prefix won't be deleted
func (o *Object) removeSegments(except string) error {
- segmentsContainer, prefix, err := o.getSegmentsDlo()
- err = o.fs.listContainerRoot(segmentsContainer, prefix, "", false, true, true, func(remote string, object *swift.Object, isDirectory bool) error {
+ segmentsContainer, _, err := o.getSegmentsDlo()
+ if err != nil {
+ return err
+ }
+ except = path.Join(o.remote, except)
+ // fs.Debugf(o, "segmentsContainer %q prefix %q", segmentsContainer, prefix)
+ err = o.fs.listContainerRoot(segmentsContainer, o.remote, "", false, true, true, func(remote string, object *swift.Object, isDirectory bool) error {
if isDirectory {
return nil
}
if except != "" && strings.HasPrefix(remote, except) {
- // fs.Debugf(o, "Ignoring current segment file %q in container %q", segmentsRoot+remote, segmentsContainer)
+ // fs.Debugf(o, "Ignoring current segment file %q in container %q", remote, segmentsContainer)
return nil
}
fs.Debugf(o, "Removing segment file %q in container %q", remote, segmentsContainer)