From 69e5e107a08d691b72f2568d2ecb40f69ec50a0f Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Wed, 17 May 2023 10:07:11 +0200 Subject: [PATCH] [BUGFIX] Allow sub directories for form definitions Frontend and listing in the backend module allow form definitions within subdirectories but editing a definition throws an exception because of a too strict comparison. Resolves: #100892 Releases: main, 12.4, 11.5 Change-Id: Ib76ce20535286b7830183111af628c686d4b0506 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79224 Tested-by: core-ci <typo3@b13.com> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> --- .../Classes/Mvc/Persistence/FormPersistenceManager.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php b/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php index ee7c86b1da95..d38537acf3c6 100644 --- a/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php +++ b/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php @@ -872,7 +872,13 @@ class FormPersistenceManager implements FormPersistenceManagerInterface $pathInfo = PathUtility::pathinfo($fileName, PATHINFO_DIRNAME); $pathInfo = is_string($pathInfo) ? $pathInfo : ''; $dirName = rtrim($pathInfo, '/') . '/'; - return array_key_exists($dirName, $this->getAccessibleFormStorageFolders()); + + foreach (array_keys($this->getAccessibleFormStorageFolders()) as $allowedPath) { + if (str_starts_with($dirName, $allowedPath)) { + return true; + } + } + return false; } /** -- GitLab