From 66dd9681f3ab52a5e48cf86d5190e9667fd6486a Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Tue, 13 Jan 2026 12:36:22 +0100 Subject: [PATCH] Fix file sorting e.g. for gallery --- src/Helper/ToolboxFile.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Helper/ToolboxFile.php b/src/Helper/ToolboxFile.php index af3f0a4b6..7b1f36c0f 100644 --- a/src/Helper/ToolboxFile.php +++ b/src/Helper/ToolboxFile.php @@ -3,7 +3,7 @@ /** * This file is part of MetaModels/core. * - * (c) 2012-2025 The MetaModels team. + * (c) 2012-2026 The MetaModels team. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -20,7 +20,7 @@ * @author Ingolf Steinhardt * @author Sven Baumann * @author Andreas Fischer - * @copyright 2012-2025 The MetaModels team. + * @copyright 2012-2026 The MetaModels team. * @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later * @filesource */ @@ -802,6 +802,10 @@ protected function sortByIdList($sortIds) $fileKeys = array_flip(array_keys($this->uuidMap)); $sorted = []; foreach ($sortIds as $sortStringId) { + if (!isset($fileKeys[$sortStringId])) { + continue; + } + $key = $fileKeys[$sortStringId]; $sorted[$key] = $fileMap[$key]; unset($fileMap[$key]);