Fixed build docs regex security (#17012)
This commit is contained in:
parent
ea326c0a4f
commit
ef28f1078c
1 changed files with 1 additions and 1 deletions
|
|
@ -199,7 +199,7 @@ def convert_plaintext_links_to_html(content):
|
||||||
for text_node in paragraph.find_all(string=True, recursive=False):
|
for text_node in paragraph.find_all(string=True, recursive=False):
|
||||||
if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks
|
if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks
|
||||||
new_text = re.sub(
|
new_text = re.sub(
|
||||||
r'(https?://[^\s()<>]+(?:\.[^\s()<>]+)+)(?<![.,:;\'"])',
|
r'\b(https?://(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:/[a-zA-Z0-9\-._~:/?#[\]@!$&\'()*+,;=%]*)?)(?<![.,:;\'"])',
|
||||||
r'<a href="\1">\1</a>',
|
r'<a href="\1">\1</a>',
|
||||||
str(text_node),
|
str(text_node),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue