diff --git a/main.go b/main.go index 5a835ba..eb4e0c5 100644 --- a/main.go +++ b/main.go @@ -5,8 +5,10 @@ import ( "fmt" "io" "log" + "mime" "net/http" "os" + "path" "strings" "git.mills.io/prologic/pages-server/gitea" @@ -41,6 +43,10 @@ func (h *GiteaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + extension := path.Ext(r.URL.Path) + mimeType := mime.TypeByExtension(extension) + w.Header().Add("content-type", mimeType) + if _, err := io.Copy(w, f); err != nil { http.Error(w, "Internal Server Error", http.StatusInternalServerError) }