[plugin] NewsDownloader: don't try to strip <script> tags (#13260)
Some checks failed
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Has been cancelled
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Has been cancelled

`<script src="etc"></script>` is turned into `<script/>`, which can cause far too much to be stripped.

While that could be dealt with a bit better, for example by first stripping self-closing and then regular, it feels hacky to do so.

See <https://github.com/koreader/koreader/pull/13188#issuecomment-2660362639>.
This commit is contained in:
Frans de Jonge
2025-02-15 10:37:49 +01:00
committed by GitHub
parent 5a6fd741cd
commit b8a31ef182

View File

@@ -333,9 +333,6 @@ function EpubDownloadBackend:createEpub(epub_path, html, url, include_images, me
local cre = require("libs/libkoreader-cre")
html = cre.getBalancedHTML(html, 0x0)
-- Remove all script tags to save a few bytes.
html = html:gsub("<script.->.-</script>", "")
-- local sections = html.sections -- Wikipedia provided TOC
local bookid = "bookid_placeholder" --string.format("wikipedia_%s_%s_%s", lang, phtml.pageid, phtml.revid)
-- Not sure if this bookid may ever be used by indexing software/calibre, but if it is,