mirror of
https://gerrit.hackerspace.pl/hscloud
synced 2025-03-21 06:44:53 +00:00
devtools/hackdoc: serve JS with correct mimetype
This allows us to serve rich content from hackdoc, eg. hbj11's webflaser. Change-Id: Ife83888d864db0b2eddf3a50b0129be0172aad8a
This commit is contained in:
parent
a025e63263
commit
56c262f2b6
2 changed files with 10 additions and 3 deletions
|
@ -151,7 +151,14 @@ func (r *request) handleFile(path string, cfg *config.Config) {
|
|||
}
|
||||
|
||||
// Just serve the file.
|
||||
mime := mimetype.Detect(data)
|
||||
r.w.Header().Set("Content-Type", mime.String())
|
||||
var mime string
|
||||
if strings.HasSuffix(path, ".js") {
|
||||
// Force .js to always be the correct MIME type.
|
||||
mime = "text/javascript"
|
||||
} else {
|
||||
// Otherwise, use magic to detect type.
|
||||
mime = mimetype.Detect(data).String()
|
||||
}
|
||||
r.w.Header().Set("Content-Type", mime)
|
||||
r.w.Write(data)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ local kube = import "../../kube/kube.libsonnet";
|
|||
|
||||
{
|
||||
cfg:: {
|
||||
image: "registry.k0.hswaw.net/q3k/hackdoc:315532800-a415ced850425a195f96b331f57cd78f15e622d9",
|
||||
image: "registry.k0.hswaw.net/q3k/hackdoc:315532800-f4d02581f60b18a8635d026079ed67039cdc45e6",
|
||||
publicFQDN: error "public FQDN must be set",
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue