mirror of
https://github.com/daledavies/jump.git
synced 2026-05-06 19:26:59 +02:00
Fix Issue #82: ampersand in url in sites.json breaks icon
This commit is contained in:
@@ -18,14 +18,15 @@ use \Jump\Exceptions\APIException;
|
||||
class Icon extends AbstractAPI {
|
||||
|
||||
public function get_output(): string {
|
||||
if (!isset($this->routeparams['siteurl']) || empty($this->routeparams['siteurl'])) {
|
||||
throw new APIException('The siteurl query parameter is not provided or empty');
|
||||
if (!isset($this->routeparams['siteid']) || empty($this->routeparams['siteid'])) {
|
||||
throw new APIException('The siteid query parameter is not provided or empty');
|
||||
}
|
||||
|
||||
$sites = new \Jump\Sites($this->config, $this->cache);
|
||||
|
||||
$siteurl = filter_var($this->routeparams['siteurl'], FILTER_SANITIZE_URL);
|
||||
$site = $sites->get_site_by_url($siteurl);
|
||||
# A site ID can contain lowercase a-z, 0-9 and the "-" (dash) character only.
|
||||
$siteid = preg_replace("/[^a-z0-9-]/", "", $this->routeparams['siteid']);
|
||||
$site = $sites->get_site_by_id($siteid);
|
||||
|
||||
$imagedata = $site->get_favicon_image_data();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user