CGS: implement MimeTyper interface

This commit is contained in:
Nicola Murino
2020-09-28 22:12:46 +02:00
parent cd56039ab7
commit d1f0e9ae9f
5 changed files with 23 additions and 50 deletions

View File

@@ -57,15 +57,8 @@ type webDavFileInfo struct {
// ContentType implements webdav.ContentTyper interface
func (fi webDavFileInfo) ContentType(ctx context.Context) (string, error) {
var contentType string
if c, ok := fi.FileInfo.(vfs.FileContentTyper); ok {
contentType = c.GetContentType()
}
if len(contentType) > 0 {
return contentType, nil
}
contentType = mime.TypeByExtension(path.Ext(fi.file.GetVirtualPath()))
if len(contentType) > 0 {
contentType := mime.TypeByExtension(path.Ext(fi.file.GetVirtualPath()))
if contentType != "" {
return contentType, nil
}
if c, ok := fi.file.Fs.(vfs.MimeTyper); ok {