mirror of
https://github.com/danog/telegram-entities.git
synced 2024-11-26 12:14:44 +01:00
Add entity escaping to URLs
This commit is contained in:
parent
d70207fdbb
commit
73dd84277d
@ -376,7 +376,7 @@ final class Entities
|
||||
'italic' => '<i>',
|
||||
'code' => '<code>',
|
||||
'pre' => isset($entity['language']) && $entity['language'] !== '' ? '<pre language="'.$entity['language'].'">' : '<pre>',
|
||||
'text_link' => '<a href="'.$entity['url'].'">',
|
||||
'text_link' => '<a href="'.EntityTools::htmlEscape($entity['url']).'">',
|
||||
'strikethrough' => '<s>',
|
||||
"underline" => '<u>',
|
||||
"block_quote" => '<blockquote>',
|
||||
|
@ -293,6 +293,18 @@ class EntitiesTest extends TestCase
|
||||
]]
|
||||
];
|
||||
|
||||
yield [
|
||||
'test',
|
||||
'<a href="https://google.com/?arg=a&arg2=b">test</a>',
|
||||
'<a href="https://google.com/?arg=a&arg2=b">test</a>',
|
||||
[[
|
||||
'type' => 'text_link',
|
||||
'offset' => 0,
|
||||
'length' => 4,
|
||||
'url' => 'https://google.com/?arg=a&arg2=b',
|
||||
]]
|
||||
];
|
||||
|
||||
yield [
|
||||
'test',
|
||||
'<u>test</u>',
|
||||
@ -787,17 +799,17 @@ class EntitiesTest extends TestCase
|
||||
],
|
||||
[
|
||||
'html',
|
||||
'<a href="https://google.com/">link </a>',
|
||||
'<a href="https://google.com/?a=a&b=b">link </a>',
|
||||
'link',
|
||||
[
|
||||
[
|
||||
'offset' => 0,
|
||||
'length' => 4,
|
||||
'type' => 'text_link',
|
||||
'url' => 'https://google.com/',
|
||||
'url' => 'https://google.com/?a=a&b=b',
|
||||
],
|
||||
],
|
||||
'<a href="https://google.com/">link</a> ',
|
||||
'<a href="https://google.com/?a=a&b=b">link</a> ',
|
||||
],
|
||||
[
|
||||
'markdown',
|
||||
|
Loading…
Reference in New Issue
Block a user