fix: mkv videos not playing on browser

This commit is contained in:
jabuxas 2024-09-19 15:47:24 -03:00
parent e341d2f166
commit 9d5fbca929

View File

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