From 291c8e62c3e750470bfe59fd30f942ff80428efa Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Tue, 26 May 2026 17:00:10 +0200 Subject: [PATCH] [FIX] Content Style: delete image from IRSS container (47832) Images of content styles are stored in the IRSS container since the IRSS migration. Upload and listing already use IRSS, but ImageFileRepo::deleteImageByFilename() still removed the file from the legacy web directory sty/sty_/images, which does not exist for migrated styles. The delete action therefore had no effect. Delete the entry from the IRSS container via IRSSWrapper::removePathFromContainer() and keep the legacy delete as a fallback for non-migrated styles. Mantis: 47832 --- .../Style/Content/Images/class.ImageFileRepo.php | 11 ++++++++--- .../ILIAS/Style/Content/Images/class.ImageManager.php | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/ILIAS/Style/Content/Images/class.ImageFileRepo.php b/components/ILIAS/Style/Content/Images/class.ImageFileRepo.php index 09b8de2817c2..2169038b9a1d 100755 --- a/components/ILIAS/Style/Content/Images/class.ImageFileRepo.php +++ b/components/ILIAS/Style/Content/Images/class.ImageFileRepo.php @@ -198,10 +198,15 @@ public function getByFilename(int $style_id, string $rid, string $filename): ?Im } // delete image - public function deleteImageByFilename(int $style_id, string $filename): void + public function deleteImageByFilename(int $style_id, string $rid, string $filename): void { - $dir = $this->dir($style_id); - $this->web_files->delete($dir . "/" . $filename); + if ($rid !== "") { + $this->irss->removePathFromContainer($rid, "images/" . $filename); + } + $legacy_path = $this->dir($style_id) . "/" . $filename; + if ($this->web_files->has($legacy_path)) { + $this->web_files->delete($legacy_path); + } } public function importFromUploadResult( diff --git a/components/ILIAS/Style/Content/Images/class.ImageManager.php b/components/ILIAS/Style/Content/Images/class.ImageManager.php index ffd8610be1e4..145cfc043177 100755 --- a/components/ILIAS/Style/Content/Images/class.ImageManager.php +++ b/components/ILIAS/Style/Content/Images/class.ImageManager.php @@ -151,7 +151,8 @@ public function supportsResize( public function deleteByFilename(string $filename): void { - $this->repo->deleteImageByFilename($this->style_id, $filename); + $rid = $this->style_repo->readRid($this->style_id); + $this->repo->deleteImageByFilename($this->style_id, $rid, $filename); } public function importFromUploadResult(