This commit is contained in:
Yuri Kuznetsov
2023-07-17 16:15:25 +03:00
parent a20e7566c9
commit 2cebfc8046
2 changed files with 4 additions and 4 deletions
@@ -29,9 +29,9 @@
namespace Espo\Core\Portal\Utils;
use Espo\Core\Exceptions\Error;
use Espo\Core\Utils\Layout as LayoutBase;
use Espo\Core\Utils\Resource\FileReader\Params as FileReaderParams;
use RuntimeException;
class Layout extends LayoutBase
{
@@ -41,7 +41,7 @@ class Layout extends LayoutBase
$this->sanitizeInput($scope) !== $scope ||
$this->sanitizeInput($name) !== $name
) {
throw new Error("Bad parameters.");
throw new RuntimeException("Bad parameters.");
}
$path = 'layouts/' . $scope . '/portal/' . $name . '.json';
+2 -2
View File
@@ -84,7 +84,7 @@ class Layout
$defaultImpl = $this->injectableFactory->create($defaultImplClassName);
if (!method_exists($defaultImpl, 'get')) {
throw new RuntimeException("No 'get' method in '{$defaultImplClassName}'.");
throw new RuntimeException("No 'get' method in '$defaultImplClassName'.");
}
$data = $defaultImpl->get($scope);
@@ -104,6 +104,6 @@ class Layout
protected function sanitizeInput(string $name): string
{
/** @var string */
return preg_replace("([\.]{2,})", '', $name);
return preg_replace("([.]{2,})", '', $name);
}
}