1
0
mirror of https://github.com/rclone/rclone.git synced 2025-11-23 21:44:49 +02:00

fs: allow Metadata calls to be called with Directory or Object

This involved adding the Fs() method to DirEntry as it is needed in
the metadata mapper.

Unspecialised fs.Dir objects will return a new fs.Unknown from their
Fs() methods as they are not specific to any given Fs.
This commit is contained in:
Nick Craig-Wood
2024-02-07 15:00:23 +00:00
parent e1032f693f
commit fd1ca2dfe8
5 changed files with 43 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ func MimeTypeFromName(remote string) (mimeType string) {
// MimeType returns the MimeType from the object, either by calling
// the MimeTyper interface or using MimeTypeFromName
func MimeType(ctx context.Context, o ObjectInfo) (mimeType string) {
func MimeType(ctx context.Context, o DirEntry) (mimeType string) {
// Read the MimeType from the optional interface if available
if do, ok := o.(MimeTyper); ok {
mimeType = do.MimeType(ctx)