Manager: fix mime type for JavaScript files
Go on Windows doesn't know `.js` files should be served with `application/javascript` mime type, and thus uses the generic `text/plain` type.
This commit is contained in:
parent
3c290b1f6d
commit
cf2d0b553f
@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"mime"
|
||||
"net/http"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -27,6 +28,12 @@ func WebAppHandler() (http.Handler, error) {
|
||||
// found.
|
||||
wrappedFS := WrapFS(fs, "index.html")
|
||||
|
||||
// Windows doesn't know this mime type. Web browsers won't load the webapp JS
|
||||
// file when it's served as text/plain.
|
||||
if err := mime.AddExtensionType(".js", "application/javascript"); err != nil {
|
||||
return nil, fmt.Errorf("registering mime type for JavaScript files: %w", err)
|
||||
}
|
||||
|
||||
return http.FileServer(http.FS(wrappedFS)), nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user