From b50f8d53a11686d2e1629edeca26337f3c167af4 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Mon, 4 Dec 2023 21:25:35 +0300 Subject: [PATCH] ltrim('/') ExApp script, style, icons urls --- lib/Service/UI/FilesActionsMenuService.php | 2 +- lib/Service/UI/ScriptsService.php | 6 +----- lib/Service/UI/StylesService.php | 7 +------ lib/Service/UI/TopMenuService.php | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/Service/UI/FilesActionsMenuService.php b/lib/Service/UI/FilesActionsMenuService.php index 48e0c767..0c032510 100644 --- a/lib/Service/UI/FilesActionsMenuService.php +++ b/lib/Service/UI/FilesActionsMenuService.php @@ -58,7 +58,7 @@ public function registerFileActionMenu(string $appId, string $name, string $disp 'name' => $name, 'display_name' => $displayName, 'action_handler' => $actionHandler, - 'icon' => $icon, + 'icon' => ltrim($icon, '/'), 'mime' => $mime, 'permissions' => $permissions, 'order' => $order, diff --git a/lib/Service/UI/ScriptsService.php b/lib/Service/UI/ScriptsService.php index aeca3527..2b2dfd9b 100644 --- a/lib/Service/UI/ScriptsService.php +++ b/lib/Service/UI/ScriptsService.php @@ -95,11 +95,7 @@ public function applyExAppScripts(string $appId, string $type, string $name): ar } else { Util::addScript(Application::APP_ID, $fakeJsPath, $value['after_app_id']); } - if (str_starts_with($value['path'], '/')) { - $mapResult[$i] = $appId . $value['path']; - } else { - $mapResult[$i] = $appId . '/' . $value['path']; - } + $mapResult[$i] = $appId . '/' . ltrim($value['path'], '/'); $i++; } return $mapResult; diff --git a/lib/Service/UI/StylesService.php b/lib/Service/UI/StylesService.php index bafd3899..e5172866 100644 --- a/lib/Service/UI/StylesService.php +++ b/lib/Service/UI/StylesService.php @@ -79,12 +79,7 @@ public function deleteExAppStyles(string $appId): int { public function applyExAppStyles(string $appId, string $type, string $name): void { $styles = $this->mapper->findByAppIdTypeName($appId, $type, $name); foreach ($styles as $value) { - if (str_starts_with($value['path'], '/')) { - // in the future we should allow offload of styles to the NC instance if they start with '/' - $path = 'proxy/'. $appId . $value['path']; - } else { - $path = 'proxy/'. $appId . '/' . $value['path']; - } + $path = 'proxy/'. $appId . '/' . ltrim($value['path'], '/'); Util::addStyle(Application::APP_ID, $path); } } diff --git a/lib/Service/UI/TopMenuService.php b/lib/Service/UI/TopMenuService.php index 2dee9740..19024665 100644 --- a/lib/Service/UI/TopMenuService.php +++ b/lib/Service/UI/TopMenuService.php @@ -84,7 +84,7 @@ public function registerExAppMenuEntry(string $appId, string $name, string $disp 'appid' => $appId, 'name' => $name, 'display_name' => $displayName, - 'icon' => $icon, + 'icon' => ltrim($icon, '/'), 'admin_required' => $adminRequired, ]); if ($menuEntry !== null) {