Skip to content

Commit

Permalink
azureblob: fix "Entry doesn't belong in directory" errors when using …
Browse files Browse the repository at this point in the history
…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 rclone#7038
  • Loading branch information
ncw committed Jun 23, 2023
1 parent 3e2a606 commit 72b7950
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/azureblob/azureblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -1063,11 +1063,7 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string,
fs.Debugf(f, "Odd name received %q", remote)
continue
}
remote = remote[len(prefix):]
isDirectory := isDirectoryMarker(*file.Properties.ContentLength, file.Metadata, remote)
if addContainer {
remote = path.Join(containerName, remote)
}
if isDirectory {
// Don't insert the root directory
if remote == directory {
Expand All @@ -1076,6 +1072,10 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string,
// process directory markers as directories
remote = strings.TrimRight(remote, "/")
}
remote = remote[len(prefix):]
if addContainer {
remote = path.Join(containerName, remote)
}
// Send object
err = fn(remote, file, isDirectory)
if err != nil {
Expand Down

0 comments on commit 72b7950

Please sign in to comment.