feature (plg_security_svg): admin can decide upon viewing svg documents

This commit is contained in:
=
2019-04-22 18:24:32 +10:00
parent c5db893a5e
commit b2d6f5f1e4
3 changed files with 48 additions and 1 deletions

View File

@ -235,7 +235,9 @@ func FileCat(ctx App, res http.ResponseWriter, req *http.Request) {
header.Set("Content-Length", fmt.Sprintf("%d", contentLength))
}
header.Set("Content-Type", GetMimeType(req.URL.Query().Get("path")))
header.Set("Content-Security-Policy", "script-src 'none'")
if header.Get("Content-Security-Policy") == "" {
header.Set("Content-Security-Policy", "default-src 'none'; img-src 'self'; style-src 'unsafe-inline'")
}
header.Set("Accept-Ranges", "bytes")
// Send data to the client