1
0
Fork 0
mirror of https://github.com/Luzifer/password.git synced 2024-12-20 12:51:17 +00:00

Fix: Serve needs to provide proper mime types

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-12-30 11:23:30 +01:00
parent bb3b175c66
commit 78cab7a245
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -3,12 +3,15 @@ package main
import (
"fmt"
"log"
"mime"
"net/http"
"path"
"strconv"
pwd "github.com/Luzifer/password/lib"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
pwd "github.com/Luzifer/password/lib"
)
func getCmdServe() *cobra.Command {
@ -76,5 +79,7 @@ func handleAssets(res http.ResponseWriter, r *http.Request) {
http.Error(res, "Unable to load interface", http.StatusInternalServerError)
return
}
res.Header().Set("Content-Type", mime.TypeByExtension(path.Base(r.URL.Path)))
res.Write(buf)
}