Skip to content

Commit

Permalink
cutoff starting slash in ExApp url before writing to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Dec 4, 2023
1 parent fb81d01 commit dacee04
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Service/UI/FilesActionsMenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function registerFileActionMenu(string $appId, string $name, string $disp
'appid' => $appId,
'name' => $name,
'display_name' => $displayName,
'action_handler' => $actionHandler,
'action_handler' => ltrim($actionHandler, '/'),
'icon' => ltrim($icon, '/'),
'mime' => $mime,
'permissions' => $permissions,
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/UI/ScriptsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setExAppScript(string $appId, string $type, string $name, string
'appid' => $appId,
'type' => $type,
'name' => $name,
'path' => $path,
'path' => ltrim($path, '/'),
'after_app_id' => $afterAppId,
]);
if ($script !== null) {
Expand Down Expand Up @@ -95,7 +95,7 @@ public function applyExAppScripts(string $appId, string $type, string $name): ar
} else {
Util::addScript(Application::APP_ID, $fakeJsPath, $value['after_app_id']);
}
$mapResult[$i] = $appId . '/' . ltrim($value['path'], '/');
$mapResult[$i] = $appId . '/' . $value['path'];
$i++;
}
return $mapResult;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/UI/StylesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function setExAppStyle(string $appId, string $type, string $name, string
'appid' => $appId,
'type' => $type,
'name' => $name,
'path' => $path,
'path' => ltrim($path, '/'),
]);
if ($style !== null) {
$newStyle->setId($style->getId());
Expand Down Expand Up @@ -79,7 +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) {
$path = 'proxy/'. $appId . '/' . ltrim($value['path'], '/');
$path = 'proxy/'. $appId . '/' . $value['path'];
Util::addStyle(Application::APP_ID, $path);
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/filesplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ function loadExAppInlineSvgIcon(appId, route) {
}

function generateAppAPIProxyUrl(appId, route) {
// truncate leading slash
if (route.startsWith('/')) {
route = route.substring(1)
}
return generateUrl(`/apps/app_api/proxy/${appId}/${route}`)
}

Expand Down

0 comments on commit dacee04

Please sign in to comment.