Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Controller/IconController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public function getIcon($base64Url, $credentialId) {

try {
$icon = new IconService($url);
if ($icon->icoExists) {
if ($icon->icoExists && !empty($icon->icoData)) {
$data = $icon->icoData;
$type = $icon->icoType;
$type = $icon->icoType ?? $type;
}
} catch (\InvalidArgumentException) {
//no need to do stuff in catch
Expand Down
10 changes: 7 additions & 3 deletions lib/Service/IconService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class IconService {
/**
* @var string favicon type (file extension, ex: ico|gif|png)
*/
public string $icoType;
public ?string $icoType = null;

/**
* @var string favicon url determination method (default /favicon.ico or found in head>link tag)
Expand All @@ -75,12 +75,12 @@ class IconService {
/**
* @var string md5 of $icoData
*/
public string $icoMd5;
public ?string $icoMd5 = null;

/**
* @var string favicon binary data
*/
public string $icoData;
public ?string $icoData = null;

/**
* @var array Additional debug info
Expand Down Expand Up @@ -307,6 +307,10 @@ public function downloadFavicon() {
return false;
}

if (empty($this->icoType)) {
$this->icoType = self::getExtension($this->icoUrl);
}

// All right baby !
$this->icoData = $content;
$this->icoMd5 = md5((string) $content);
Expand Down
Loading