mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 14:51:48 +08:00
s3: fix "Entry doesn't belong in directory" errors when using directory markers
Before this change we were incorrectly identifying the root directory of the listing and adding it into the listing. This caused higher layers of rclone to emit the error above. See #7038
This commit is contained in:
parent
72b79504ea
commit
5f938fb9ed
|
@ -3727,11 +3727,7 @@ func (f *Fs) list(ctx context.Context, opt listOpt, fn listFn) error {
|
|||
fs.Logf(f, "Odd name received %q", remote)
|
||||
continue
|
||||
}
|
||||
remote = remote[len(opt.prefix):]
|
||||
isDirectory := (remote == "" || strings.HasSuffix(remote, "/")) && object.Size != nil && *object.Size == 0
|
||||
if opt.addBucket {
|
||||
remote = bucket.Join(opt.bucket, remote)
|
||||
}
|
||||
// is this a directory marker?
|
||||
if isDirectory {
|
||||
if opt.noSkipMarkers {
|
||||
|
@ -3746,6 +3742,10 @@ func (f *Fs) list(ctx context.Context, opt listOpt, fn listFn) error {
|
|||
remote = strings.TrimRight(remote, "/")
|
||||
}
|
||||
}
|
||||
remote = remote[len(opt.prefix):]
|
||||
if opt.addBucket {
|
||||
remote = bucket.Join(opt.bucket, remote)
|
||||
}
|
||||
if versionIDs != nil {
|
||||
err = fn(remote, object, versionIDs[i], isDirectory)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user