1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-11-27 02:25:41 +00:00

types: webm must not have a mimetype yet?

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-08-08 16:18:44 -04:00
parent 4a23b6bac1
commit 3c6deccbea
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -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")
}