From 8225ab80f849b67e87ec9f51b113e4f03da3f41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20Gro=C3=9Fberndt?= <stephan@grossberndt.de>
Date: Wed, 18 Oct 2017 16:01:26 +0200
Subject: [PATCH] [BUGFIX] Fix editing a FileStorage from FileTree on
 PostgreSQL

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/54436
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
---
 typo3/sysext/backend/Classes/Utility/BackendUtility.php         | 2 +-
 .../filelist/Resources/Public/JavaScript/ContextMenuActions.js  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
index bff7ff157ba7..c384d8a9eaac 100644
--- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php
+++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
@@ -130,7 +130,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) {
diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js b/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js
index d2d70dd02a49..045b826b1a51 100644
--- a/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js
+++ b/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js
@@ -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()
         );
     };
 
-- 
GitLab