1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Improve img lazy loading (#34804)

Related #32051 and #13526
This commit is contained in:
wxiaoguang
2025-06-21 14:53:22 +08:00
committed by GitHub
parent 0990eb44ce
commit 81adb01713
11 changed files with 30 additions and 17 deletions

View File

@@ -52,6 +52,8 @@ func (st *Sanitizer) createDefaultPolicy() *bluemonday.Policy {
policy.AllowAttrs("src", "autoplay", "controls").OnElements("video")
policy.AllowAttrs("loading").OnElements("img")
// Allow generally safe attributes (reference: https://github.com/jch/html-pipeline)
generalSafeAttrs := []string{
"abbr", "accept", "accept-charset",