fix root icon urls

This commit is contained in:
Yisroel Baum 2026-06-26 10:58:04 +03:00
parent 47254ea356
commit 0ec8403d4f
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -339,9 +339,8 @@ class ElementController
'id' => $element->getId(),
'title' => $element->getTitle(),
'description' => $element->getDescription(),
'iconImageUrl' => $this->storageUrl(
$element->getIconImageUrl(),
'element-icons/',
'iconImageUrl' => $this->iconImageUrl(
$element->getIconImageUrl()
),
'richText' => $element->getRichText(),
'shortPdfPath' => $this->storageUrl(
@ -397,6 +396,22 @@ class ElementController
];
}
private function iconImageUrl(?string $path): ?string
{
if ($path === null) {
return null;
}
if (
str_starts_with($path, 'element-icons/')
|| str_starts_with($path, 'set-icons/')
) {
return $this->filesystem->url($path);
}
return $path;
}
private function storageUrl(?string $path, string $folderPrefix): ?string
{
if ($path === null) {