fix (csp): csp policy on cat

The issue this is fixing is for the plg_opener_htmlframe which does
open html documents as an iframe. Without this, we couldn't load any
js at all which was causing issue to render things like markdown via
external libs and such
This commit is contained in:
Mickael Kerjean 2022-05-13 08:43:47 +10:00
parent db7ab46ddd
commit f72b630e50

View file

@ -278,7 +278,7 @@ func FileCat(ctx App, res http.ResponseWriter, req *http.Request) {
header.Set("Content-Length", fmt.Sprintf("%d", contentLength))
}
if header.Get("Content-Security-Policy") == "" {
header.Set("Content-Security-Policy", "default-src 'none'; img-src 'self'; media-src 'self'; style-src 'unsafe-inline'; font-src data:")
header.Set("Content-Security-Policy", "default-src 'none'; img-src 'self'; media-src 'self'; style-src 'unsafe-inline'; font-src data:; script-src-elem 'self'")
}
header.Set("Accept-Ranges", "bytes")