mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 03:36:16 +00:00
Fix wrong mime-type
This commit is contained in:
parent
efa267db98
commit
cb52d95882
@ -76,7 +76,7 @@ func handlerText(w http.ResponseWriter, rq *http.Request) {
|
||||
hyphaName := HyphaNameFromRq(rq, "text")
|
||||
if data, ok := HyphaStorage[hyphaName]; ok {
|
||||
log.Println("Serving", data.textPath)
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
http.ServeFile(w, rq, data.textPath)
|
||||
}
|
||||
}
|
||||
|
23
mime.go
23
mime.go
@ -27,17 +27,18 @@ func MimeToExtension(mime string) string {
|
||||
|
||||
func ExtensionToMime(ext string) string {
|
||||
mm := map[string]string{
|
||||
"bin": "application/octet-stream",
|
||||
"jpg": "image/jpeg",
|
||||
"gif": "image/gif",
|
||||
"png": "image/png",
|
||||
"webp": "image/webp",
|
||||
"svg": "image/svg+xml",
|
||||
"ico": "image/x-icon",
|
||||
"ogg": "application/ogg",
|
||||
"webm": "video/webm",
|
||||
"mp3": "audio/mp3",
|
||||
"mp4": "video/mp4",
|
||||
".bin": "application/octet-stream",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".gif": "image/gif",
|
||||
".png": "image/png",
|
||||
".webp": "image/webp",
|
||||
".svg": "image/svg+xml",
|
||||
".ico": "image/x-icon",
|
||||
".ogg": "application/ogg",
|
||||
".webm": "video/webm",
|
||||
".mp3": "audio/mp3",
|
||||
".mp4": "video/mp4",
|
||||
}
|
||||
if mime, ok := mm[ext]; ok {
|
||||
return mime
|
||||
|
Loading…
Reference in New Issue
Block a user