mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 11:55:01 +01:00
swift: fix parsing of X-Object-Manifest
Before this change we forgot to URL decode the X-Object-Manifest in a dynamic large object.
This problem was introduced by 2fe8285f89
"swift: reserve
segments of dynamic large object when delete objects in container what
was enabled versioning."
This commit is contained in:
parent
4641bd5116
commit
1db31d7149
@ -7,6 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -952,8 +953,8 @@ func (o *Object) isStaticLargeObject() (bool, error) {
|
|||||||
return o.hasHeader("X-Static-Large-Object")
|
return o.hasHeader("X-Static-Large-Object")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Object) isInContainerVersioning() (bool, error) {
|
func (o *Object) isInContainerVersioning(container string) (bool, error) {
|
||||||
_, headers, err := o.fs.c.Container(o.fs.root)
|
_, headers, err := o.fs.c.Container(container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -1130,6 +1131,10 @@ func (o *Object) getSegmentsDlo() (segmentsContainer string, prefix string, err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dirManifest := o.headers["X-Object-Manifest"]
|
dirManifest := o.headers["X-Object-Manifest"]
|
||||||
|
dirManifest, err = url.PathUnescape(dirManifest)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
delimiter := strings.Index(dirManifest, "/")
|
delimiter := strings.Index(dirManifest, "/")
|
||||||
if len(dirManifest) == 0 || delimiter < 0 {
|
if len(dirManifest) == 0 || delimiter < 0 {
|
||||||
err = errors.New("Missing or wrong structure of manifest of Dynamic large object")
|
err = errors.New("Missing or wrong structure of manifest of Dynamic large object")
|
||||||
@ -1341,7 +1346,7 @@ func (o *Object) Remove(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
// ...then segments if required
|
// ...then segments if required
|
||||||
if isDynamicLargeObject {
|
if isDynamicLargeObject {
|
||||||
isInContainerVersioning, err := o.isInContainerVersioning()
|
isInContainerVersioning, err := o.isInContainerVersioning(container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user