forked from GNUsocial/gnu-social
[Embed] Fixed bug where sometimes images were written outside the site root
This commit is contained in:
parent
a244f3ba4d
commit
d66828c2bf
@ -451,6 +451,7 @@ class EmbedPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
$head = (new HTTPClient())->head($url);
|
$head = (new HTTPClient())->head($url);
|
||||||
$headers = $head->getHeader();
|
$headers = $head->getHeader();
|
||||||
|
$headers = array_change_key_case($headers, CASE_LOWER);
|
||||||
}
|
}
|
||||||
return $headers['content-length'] ?: false;
|
return $headers['content-length'] ?: false;
|
||||||
} catch (Exception $err) {
|
} catch (Exception $err) {
|
||||||
@ -475,6 +476,7 @@ class EmbedPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
$head = (new HTTPClient())->head($url);
|
$head = (new HTTPClient())->head($url);
|
||||||
$headers = $head->getHeader();
|
$headers = $head->getHeader();
|
||||||
|
$headers = array_change_key_case($headers, CASE_LOWER);
|
||||||
}
|
}
|
||||||
return !empty($headers['content-type']) && common_get_mime_media($headers['content-type']) === 'image';
|
return !empty($headers['content-type']) && common_get_mime_media($headers['content-type']) === 'image';
|
||||||
}
|
}
|
||||||
@ -498,6 +500,7 @@ class EmbedPlugin extends Plugin
|
|||||||
|
|
||||||
$head = (new HTTPClient())->head($url);
|
$head = (new HTTPClient())->head($url);
|
||||||
$headers = $head->getHeader();
|
$headers = $head->getHeader();
|
||||||
|
$headers = array_change_key_case($headers, CASE_LOWER);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$isImage = $this->isRemoteImage($url, $headers);
|
$isImage = $this->isRemoteImage($url, $headers);
|
||||||
|
Loading…
Reference in New Issue
Block a user