diff --git a/backend/app/Controllers/ElementController.php b/backend/app/Controllers/ElementController.php index 5fc14d7..31c162c 100644 --- a/backend/app/Controllers/ElementController.php +++ b/backend/app/Controllers/ElementController.php @@ -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) {