Fixed Flex directory configuration creating environment configuration when it should not

This commit is contained in:
Matias Griese 2021-12-22 21:28:26 +02:00
parent 26295d5cf2
commit 4519971a76
2 changed files with 13 additions and 3 deletions

View File

@ -22,6 +22,7 @@
* Fixed Twig being very slow when template overrides do not exist
* Fixed `UserObject::$authorizeCallable` binding to the user object
* Fixed `FlexIndex::call()` to return null instead of failing to call undefined method
* Fixed Flex directory configuration creating environment configuration when it should not
# v1.7.25
## 11/16/2021

View File

@ -21,7 +21,7 @@ use Grav\Common\Utils;
use Grav\Framework\Cache\Adapter\DoctrineCache;
use Grav\Framework\Cache\Adapter\MemoryCache;
use Grav\Framework\Cache\CacheInterface;
use Grav\Framework\Flex\Interfaces\FlexAuthorizeInterface;
use Grav\Framework\Filesystem\Filesystem;
use Grav\Framework\Flex\Interfaces\FlexCollectionInterface;
use Grav\Framework\Flex\Interfaces\FlexDirectoryInterface;
use Grav\Framework\Flex\Interfaces\FlexFormInterface;
@ -218,8 +218,17 @@ class FlexDirectory implements FlexDirectoryInterface
/** @var UniformResourceLocator $locator */
$locator = $grav['locator'];
/** @var string $filename Filename is always string */
$filename = $locator->findResource($this->getDirectoryConfigUri($name), true, true);
$filename = $this->getDirectoryConfigUri($name);
if (file_exists($filename)) {
$filename = $locator->findResource($filename, true);
} else {
$filesystem = Filesystem::getInstance();
$dirname = $filesystem->dirname($filename);
$basename = $filesystem->basename($filename);
$dirname = $locator->findResource($dirname, true) ?: $locator->findResource($dirname, true, true);
$filename = "{$dirname}/{$basename}";
}
$file = YamlFile::instance($filename);
if (!empty($data)) {