mirror of
https://github.com/vbatts/imgsrv.git
synced 2024-11-30 12:05:42 +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
|
// ContentType guesses the mime-type by the file's extension
|
||||||
func (f *File) ContentType() string {
|
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 {
|
func (f *File) IsImage() bool {
|
||||||
|
@ -33,9 +39,6 @@ func (f *File) IsImage() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) IsVideo() bool {
|
func (f *File) IsVideo() bool {
|
||||||
if strings.HasSuffix(f.Filename, ".webm") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return strings.HasPrefix(f.ContentType(), "video")
|
return strings.HasPrefix(f.ContentType(), "video")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue