forked from TrueCloudLab/rclone
fs: Add MimeTypeDirEntry to return the MimeType of a DirEntry
This commit is contained in:
parent
f162116132
commit
aadbcce486
1 changed files with 14 additions and 0 deletions
|
@ -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 a new issue