fix: mkv videos not playing on browser
This commit is contained in:
parent
e341d2f166
commit
9d5fbca929
@ -119,10 +119,18 @@ func (app *Application) indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
".rst": true,
|
".rst": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videoExtensions := map[string]bool{
|
||||||
|
".mkv": true,
|
||||||
|
}
|
||||||
|
|
||||||
if textExtensions[ext] {
|
if textExtensions[ext] {
|
||||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if videoExtensions[ext] {
|
||||||
|
w.Header().Set("Content-Type", "video/mp4")
|
||||||
|
}
|
||||||
|
|
||||||
http.ServeFile(w, r, path)
|
http.ServeFile(w, r, path)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user