1
mirror of https://github.com/rclone/rclone synced 2025-03-31 17:09:19 +02:00

azureblob: 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 
This commit is contained in:
Nick Craig-Wood 2023-06-10 14:18:59 +01:00
parent 3e2a606adb
commit 72b79504ea

@ -1063,11 +1063,7 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string,
fs.Debugf(f, "Odd name received %q", remote) fs.Debugf(f, "Odd name received %q", remote)
continue continue
} }
remote = remote[len(prefix):]
isDirectory := isDirectoryMarker(*file.Properties.ContentLength, file.Metadata, remote) isDirectory := isDirectoryMarker(*file.Properties.ContentLength, file.Metadata, remote)
if addContainer {
remote = path.Join(containerName, remote)
}
if isDirectory { if isDirectory {
// Don't insert the root directory // Don't insert the root directory
if remote == directory { if remote == directory {
@ -1076,6 +1072,10 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string,
// process directory markers as directories // process directory markers as directories
remote = strings.TrimRight(remote, "/") remote = strings.TrimRight(remote, "/")
} }
remote = remote[len(prefix):]
if addContainer {
remote = path.Join(containerName, remote)
}
// Send object // Send object
err = fn(remote, file, isDirectory) err = fn(remote, file, isDirectory)
if err != nil { if err != nil {