forked from TrueCloudLab/rclone
s3: make purge remove directory markers too
See: https://forum.rclone.org/t/cannot-purge-aws-s3/36169/
This commit is contained in:
parent
de9c4a3611
commit
19e8c8d42a
1 changed files with 19 additions and 17 deletions
|
@ -3477,6 +3477,7 @@ type listOpt struct {
|
||||||
hidden bool // if set, return delete markers as objects with size == isDeleteMarker
|
hidden bool // if set, return delete markers as objects with size == isDeleteMarker
|
||||||
findFile bool // if set, it will look for files called (bucket, directory)
|
findFile bool // if set, it will look for files called (bucket, directory)
|
||||||
versionAt fs.Time // if set only show versions <= this time
|
versionAt fs.Time // if set only show versions <= this time
|
||||||
|
noSkipMarkers bool // if set return dir marker objects
|
||||||
}
|
}
|
||||||
|
|
||||||
// list lists the objects into the function supplied with the opt
|
// list lists the objects into the function supplied with the opt
|
||||||
|
@ -3621,7 +3622,7 @@ func (f *Fs) list(ctx context.Context, opt listOpt, fn listFn) error {
|
||||||
remote = bucket.Join(opt.bucket, remote)
|
remote = bucket.Join(opt.bucket, remote)
|
||||||
}
|
}
|
||||||
// is this a directory marker?
|
// is this a directory marker?
|
||||||
if isDirectory && object.Size != nil && *object.Size == 0 {
|
if isDirectory && object.Size != nil && *object.Size == 0 && !opt.noSkipMarkers {
|
||||||
continue // skip directory marker
|
continue // skip directory marker
|
||||||
}
|
}
|
||||||
if versionIDs != nil {
|
if versionIDs != nil {
|
||||||
|
@ -4575,6 +4576,7 @@ func (f *Fs) purge(ctx context.Context, dir string, oldOnly bool) error {
|
||||||
recurse: true,
|
recurse: true,
|
||||||
withVersions: versioned,
|
withVersions: versioned,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
noSkipMarkers: true,
|
||||||
}, func(remote string, object *s3.Object, versionID *string, isDirectory bool) error {
|
}, func(remote string, object *s3.Object, versionID *string, isDirectory bool) error {
|
||||||
if isDirectory {
|
if isDirectory {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue