@cryptotaxi247 / kubo / commits / 69f81a11d

Update gateway_handler.go

Djalil Dreamski committed Nov 5, 2019 at 17:36 UTC 69f81a11dd23b41a4672722ad65c485400cdb14d
1 file changed +4 -1
core/corehttp/gateway_handler.go
+4 -1
@@ -383,7 +383,10 @@ func (i *gatewayHandler) serveFile(w http.ResponseWriter, req *http.Request, nam
383 }
384 }
385
386 - mime := http.DetectContentType(content)
386 + buf := make([]byte, 512)
387 + _, _ = content.Read(buf)
388 + mime := http.DetectContentType(buf)
389 +
390 if strings.HasPrefix(mime, "text/html;") {
391 mime = "text/html"
392 }