Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

lsjson: make --stat more efficient

Nick Craig-Wood335ca6d5726a
diff --git a/fs/operations/lsjson.go b/fs/operations/lsjson.go
index 176c2cb9f..6c94ee6ee 100644
--- a/fs/operations/lsjson.go
+++ b/fs/operations/lsjson.go
@@ -291,7 +291,7 @@ func StatJSON(ctx context.Context, fsrc fs.Fs, remote string, opt *ListJSONOpt)
}
// Could be a file or a directory here
- if lj.files {
+ if lj.files && !strings.HasSuffix(remote, "/") {
// NewObject can return the sentinel errors ErrorObjectNotFound or ErrorIsDir
// ErrorObjectNotFound can mean the source is a directory or not found
obj, err := fsrc.NewObject(ctx, remote)