mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
fs: Add MimeTypeDirEntry to return the MimeType of a DirEntry
This commit is contained in:
parent
f162116132
commit
aadbcce486
@ -28,3 +28,17 @@ func MimeType(o ObjectInfo) (mimeType string) {
|
||||
}
|
||||
return MimeTypeFromName(o.Remote())
|
||||
}
|
||||
|
||||
// MimeTypeDirEntry returns the MimeType of a DirEntry
|
||||
//
|
||||
// It returns "inode/directory" for directories, or uses
|
||||
// MimeType(Object)
|
||||
func MimeTypeDirEntry(item DirEntry) string {
|
||||
switch x := item.(type) {
|
||||
case Object:
|
||||
return MimeType(x)
|
||||
case Directory:
|
||||
return "inode/directory"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user