Skip to content

Commit

Permalink
Fix possibly wrong mime types
Browse files Browse the repository at this point in the history
  • Loading branch information
SmilyOrg committed Jun 16, 2022
1 parent c3ff254 commit 69d5aeb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"name": "Debug w/ UI",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}"
"program": "${workspaceFolder}",
"buildFlags": "-tags embedstatic"
}
]
}
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io/fs"
"io/ioutil"
"math"
"mime"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -1011,6 +1012,16 @@ func main() {
r.Handle("/debug/fgprof", fgprof.Handler())

if apiPrefix != "/" {
// Hardcode well-known mime types, see https://github.com/golang/go/issues/32350
mime.AddExtensionType(".js", "text/javascript")
mime.AddExtensionType(".css", "text/css")
mime.AddExtensionType(".html", "text/html")
mime.AddExtensionType(".woff", "font/woff")
mime.AddExtensionType(".woff2", "font/woff2")
mime.AddExtensionType(".png", "image/png")
mime.AddExtensionType(".jpg", "image/jpg")
mime.AddExtensionType(".jpeg", "image/jpeg")
mime.AddExtensionType(".ico", "image/vnd.microsoft.icon")
subfs, err := fs.Sub(StaticFs, "ui/dist")
if err != nil {
panic(err)
Expand Down

0 comments on commit 69d5aeb

Please sign in to comment.