diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 2e1f1d574..69614ef06 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1464,7 +1464,7 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck continue } remote = remote[len(prefix):] - isDirectory := strings.HasSuffix(remote, "/") + isDirectory := remote == "" || strings.HasSuffix(remote, "/") if addBucket { remote = path.Join(bucket, remote) }