diff --git a/types/types.go b/types/types.go index 0eefe8c..87c2099 100644 --- a/types/types.go +++ b/types/types.go @@ -25,7 +25,13 @@ type File struct { // ContentType guesses the mime-type by the file's extension func (f *File) ContentType() string { - return mime.TypeByExtension(filepath.Ext(f.Filename)) + mtype := mime.TypeByExtension(filepath.Ext(f.Filename)) + if mtype == "" { + if strings.HasSuffix(f.Filename, ".webm") { + return "video/webm; charset=binary" + } + } + return mtype } func (f *File) IsImage() bool { @@ -33,9 +39,6 @@ func (f *File) IsImage() bool { } func (f *File) IsVideo() bool { - if strings.HasSuffix(f.Filename, ".webm") { - return true - } return strings.HasPrefix(f.ContentType(), "video") }