mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 14:20:55 +03:00
WebDAV: allow to define custom MIME type mappings
Fixes #1154 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -84,6 +84,9 @@ type webDavFileInfo struct {
|
||||
// ContentType implements webdav.ContentTyper interface
|
||||
func (fi *webDavFileInfo) ContentType(ctx context.Context) (string, error) {
|
||||
extension := path.Ext(fi.virtualPath)
|
||||
if ctype, ok := customMimeTypeMapping[extension]; ok {
|
||||
return ctype, nil
|
||||
}
|
||||
if extension == "" || extension == ".dat" {
|
||||
return "application/octet-stream", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user