Skip to content

Commit

Permalink
ltrim('/') ExApp script, style, icons urls
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Dec 4, 2023
1 parent 5441d60 commit b50f8d5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Service/UI/FilesActionsMenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions lib/Service/UI/ScriptsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions lib/Service/UI/StylesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/UI/TopMenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b50f8d5

Please sign in to comment.