mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-13 05:50:27 +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")
|
hyphaName := HyphaNameFromRq(rq, "text")
|
||||||
if data, ok := HyphaStorage[hyphaName]; ok {
|
if data, ok := HyphaStorage[hyphaName]; ok {
|
||||||
log.Println("Serving", data.textPath)
|
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)
|
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 {
|
func ExtensionToMime(ext string) string {
|
||||||
mm := map[string]string{
|
mm := map[string]string{
|
||||||
"bin": "application/octet-stream",
|
".bin": "application/octet-stream",
|
||||||
"jpg": "image/jpeg",
|
".jpg": "image/jpeg",
|
||||||
"gif": "image/gif",
|
".jpeg": "image/jpeg",
|
||||||
"png": "image/png",
|
".gif": "image/gif",
|
||||||
"webp": "image/webp",
|
".png": "image/png",
|
||||||
"svg": "image/svg+xml",
|
".webp": "image/webp",
|
||||||
"ico": "image/x-icon",
|
".svg": "image/svg+xml",
|
||||||
"ogg": "application/ogg",
|
".ico": "image/x-icon",
|
||||||
"webm": "video/webm",
|
".ogg": "application/ogg",
|
||||||
"mp3": "audio/mp3",
|
".webm": "video/webm",
|
||||||
"mp4": "video/mp4",
|
".mp3": "audio/mp3",
|
||||||
|
".mp4": "video/mp4",
|
||||||
}
|
}
|
||||||
if mime, ok := mm[ext]; ok {
|
if mime, ok := mm[ext]; ok {
|
||||||
return mime
|
return mime
|
||||||
|
Loading…
Reference in New Issue
Block a user