mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-01-03 15:50:52 -05:00
Improve URL previews by not including the content of media tags in the generated description. (#12887)
This commit is contained in:
parent
9385cd0633
commit
317248d42c
1
changelog.d/12887.misc
Normal file
1
changelog.d/12887.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve URL previews by not including the content of media tags in the generated description.
|
@ -246,7 +246,9 @@ def parse_html_description(tree: "etree.Element") -> Optional[str]:
|
|||||||
|
|
||||||
Grabs any text nodes which are inside the <body/> tag, unless they are within
|
Grabs any text nodes which are inside the <body/> tag, unless they are within
|
||||||
an HTML5 semantic markup tag (<header/>, <nav/>, <aside/>, <footer/>), or
|
an HTML5 semantic markup tag (<header/>, <nav/>, <aside/>, <footer/>), or
|
||||||
if they are within a <script/> or <style/> tag.
|
if they are within a <script/>, <svg/> or <style/> tag, or if they are within
|
||||||
|
a tag whose content is usually only shown to old browsers
|
||||||
|
(<iframe/>, <video/>, <canvas/>, <picture/>).
|
||||||
|
|
||||||
This is a very very very coarse approximation to a plain text render of the page.
|
This is a very very very coarse approximation to a plain text render of the page.
|
||||||
|
|
||||||
@ -268,6 +270,12 @@ def parse_html_description(tree: "etree.Element") -> Optional[str]:
|
|||||||
"script",
|
"script",
|
||||||
"noscript",
|
"noscript",
|
||||||
"style",
|
"style",
|
||||||
|
"svg",
|
||||||
|
"iframe",
|
||||||
|
"video",
|
||||||
|
"canvas",
|
||||||
|
"img",
|
||||||
|
"picture",
|
||||||
etree.Comment,
|
etree.Comment,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user