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:
parent
4a23b6bac1
commit
3c6deccbea
1 changed files with 7 additions and 4 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue