mirror of
https://github.com/rclone/rclone.git
synced 2025-08-16 16:41:34 +02:00
lsjson,lsf: make sure metadata appears for directories
This commit is contained in:
@ -194,6 +194,14 @@ func (lj *listJSON) entry(ctx context.Context, entry fs.DirEntry) (*ListJSONItem
|
||||
}
|
||||
item.Encrypted = path.Base(item.EncryptedPath)
|
||||
}
|
||||
if lj.opt.Metadata {
|
||||
metadata, err := fs.GetMetadata(ctx, entry)
|
||||
if err != nil {
|
||||
fs.Errorf(entry, "Failed to read metadata: %v", err)
|
||||
} else if metadata != nil {
|
||||
item.Metadata = metadata
|
||||
}
|
||||
}
|
||||
if do, ok := entry.(fs.IDer); ok {
|
||||
item.ID = do.ID()
|
||||
}
|
||||
@ -224,14 +232,6 @@ func (lj *listJSON) entry(ctx context.Context, entry fs.DirEntry) (*ListJSONItem
|
||||
item.Tier = do.GetTier()
|
||||
}
|
||||
}
|
||||
if lj.opt.Metadata {
|
||||
metadata, err := fs.GetMetadata(ctx, x)
|
||||
if err != nil {
|
||||
fs.Errorf(x, "Failed to read metadata: %v", err)
|
||||
} else if metadata != nil {
|
||||
item.Metadata = metadata
|
||||
}
|
||||
}
|
||||
default:
|
||||
fs.Errorf(nil, "Unknown type %T in listing in ListJSON", entry)
|
||||
}
|
||||
|
Reference in New Issue
Block a user