mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Harden favicon link parsing
This commit is contained in:
1 parent
9e23ba138b
commit
9dbc32d722
1 file changed
+3
-2
@@ -97,7 +97,8 @@ class Get extends Action
|
||||
$space = 0;
|
||||
|
||||
$linkTags = [];
|
||||
\preg_match_all('/<link\b[^>]*>/i', $res->getBody(), $linkTags);
|
||||
$html = \preg_replace('/<!--.*?-->/s', '', $res->getBody()) ?? $res->getBody();
|
||||
\preg_match_all('/<link\b[^>]*>/i', $html, $linkTags);
|
||||
|
||||
foreach ($linkTags[0] ?? [] as $tag) {
|
||||
$attributes = [];
|
||||
@@ -107,7 +108,7 @@ class Get extends Action
|
||||
|
||||
foreach ($attributeMatches as $attributeMatch) {
|
||||
$attributes[\strtolower($attributeMatch[1])] = \html_entity_decode(
|
||||
$attributeMatch[2] ?: $attributeMatch[3] ?: $attributeMatch[4],
|
||||
$attributeMatch[2] !== '' ? $attributeMatch[2] : ($attributeMatch[3] !== '' ? $attributeMatch[3] : $attributeMatch[4]),
|
||||
\ENT_QUOTES | \ENT_HTML5
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user