mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
CGS: implement MimeTyper interface
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user