mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Prevent path conversion of data: URL in <img> tag
This commit is contained in:
parent
de629d6d43
commit
099d8397c9
2 changed files with 6 additions and 2 deletions
|
|
@ -269,7 +269,7 @@ class TemplateHandler
|
|||
$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
|
||||
|
||||
// replace value of src in img/input/script tag
|
||||
$buff = preg_replace_callback('/<(?:img|input|script)(?:[^<>]*?)(?(?=cond=")(?:cond="[^"]+"[^<>]*)+|)[^<>]* src="(?!(?:https?|file):\/\/|[\/\{])([^"]+)"/is', array($this, '_replacePath'), $buff);
|
||||
$buff = preg_replace_callback('/<(?:img|input|script)(?:[^<>]*?)(?(?=cond=")(?:cond="[^"]+"[^<>]*)+|)[^<>]* src="(?!(?:https?|file|data):|[\/\{])([^"]+)"/is', array($this, '_replacePath'), $buff);
|
||||
|
||||
// replace value of srcset in img/source/link tag
|
||||
$buff = preg_replace_callback('/<(?:img|source|link)(?:[^<>]*?)(?(?=cond=")(?:cond="[^"]+"[^<>]*)+|)[^<>]* srcset="([^"]+)"/is', array($this, '_replaceSrcsetPath'), $buff);
|
||||
|
|
@ -503,7 +503,7 @@ class TemplateHandler
|
|||
foreach ($url_list as &$url) {
|
||||
// replace if url is not starting with the pattern
|
||||
$url = preg_replace_callback(
|
||||
'/^(?!(?:https?|file):\/\/|[\/\{])(\S+)/i',
|
||||
'/^(?!(?:https?|file|data):|[\/\{])(\S+)/i',
|
||||
array($this, '_replaceRelativePath'),
|
||||
trim($url)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue