[BUGFIX] Fix editing a FileStorage from FileTree on PostgreSQL 85/54785/2
authorStephan Großberndt <stephan@grossberndt.de>
Wed, 18 Oct 2017 14:01:26 +0000 (16:01 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 27 Nov 2017 17:56:00 +0000 (18:56 +0100)
Avoid a SQL error on PostgreSQL when editing a FileStorage from FileTree
by passing the UID instead of a combined identifier like '1:/' to
EditDocumentController. Additionally fix the possibility for an SQL
error in BackendUtility::getRecord() by casting the UID.

Releases: master, 8.7
Resolves: #82799
Change-Id: I5cfde8b53767da1166ebd5f778e36ca85825a173
Reviewed-on: https://review.typo3.org/54785
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js

index fefe6f6..437b931 100644 (file)
@@ -128,7 +128,7 @@ class BackendUtility
             $queryBuilder
                 ->select(...GeneralUtility::trimExplode(',', $fields, true))
                 ->from($table)
-                ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)));
+                ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter((int)$uid, \PDO::PARAM_INT)));
 
             // add custom where clause
             if ($where) {
index 1cf2586..074fa6f 100644 (file)
@@ -42,7 +42,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
 
     ContextMenuActions.editFileStorage = function (table, uid) {
         top.TYPO3.Backend.ContentContainer.setUrl(
-            top.TYPO3.settings.FormEngine.moduleUrl + '&edit[sys_file_storage][' + top.rawurlencode(uid) + ']=edit&returnUrl=' + ContextMenuActions.getReturnUrl()
+            top.TYPO3.settings.FormEngine.moduleUrl + '&edit[sys_file_storage][' + parseInt(uid, 10) + ']=edit&returnUrl=' + ContextMenuActions.getReturnUrl()
         );
     };