sanitize name

This commit is contained in:
Yurii
2026-03-21 17:37:26 +02:00
parent 3f43fcdf23
commit 3fab34e030
6 changed files with 16 additions and 7 deletions

View File

@@ -178,7 +178,9 @@ class MassUpdate implements MassAction
private function clearRoleCache(string $id): void
{
$this->fileManager->removeFile('data/cache/application/acl/' . $id . '.php');
$part = basename($id);
$this->fileManager->removeFile("data/cache/application/acl/$part.php");
}
private function clearPortalRolesCache(): void

View File

@@ -63,7 +63,7 @@ class Clearer
return;
}
$part = $user->getId() . '.php';
$part = basename($user->getId() . '.php');
$this->fileManager->remove('data/cache/application/acl/' . $part);
$this->fileManager->remove('data/cache/application/aclMap/' . $part);
@@ -77,7 +77,7 @@ class Clearer
->find();
foreach ($portals as $portal) {
$part = $portal->getId() . '/' . $user->getId() . '.php';
$part = basename($portal->getId()) . '/' . basename($user->getId() . '.php');
$this->fileManager->remove('data/cache/application/aclPortal/' . $part);
$this->fileManager->remove('data/cache/application/aclPortalMap/' . $part);

View File

@@ -115,7 +115,8 @@ class EspoUploadDir implements Storage, Local
protected function getFilePath(Attachment $attachment)
{
$sourceId = $attachment->getSourceId();
$file = basename($sourceId);
return 'data/upload/' . $sourceId;
return 'data/upload/' . $file;
}
}

View File

@@ -49,7 +49,9 @@ class Starter extends StarterBase
SystemConfig $systemConfig,
ApplicationState $applicationState
) {
$routeCacheFile = 'data/cache/application/slim-routes-portal-' . $applicationState->getPortalId() . '.php';
$part = basename($applicationState->getPortalId());
$routeCacheFile = 'data/cache/application/slim-routes-portal-' . $part . '.php';
parent::__construct(
$requestProcessor,

View File

@@ -174,7 +174,9 @@ class Image implements EntryPoint
$sourceId = $attachment->getSourceId();
$cacheFilePath = "data/upload/thumbs/{$sourceId}_$size";
$file = basename("{$sourceId}_$size");
$cacheFilePath = "data/upload/thumbs/$file";
if ($useCache && $this->fileManager->isFile($cacheFilePath)) {
return $this->fileManager->getContents($cacheFilePath);

View File

@@ -89,7 +89,9 @@ class RemoveFile implements AfterRemove
$sizeList = array_keys($this->metadata->get(['app', 'image', 'sizes']) ?? []);
foreach ($sizeList as $size) {
$filePath = "data/upload/thumbs/{$entity->getSourceId()}_{$size}";
$file = basename("{$entity->getSourceId()}_$size");
$filePath = "data/upload/thumbs/$file";
if ($this->fileManager->isFile($filePath)) {
$this->fileManager->removeFile($filePath);