From a566599b7f508d79e45da1c4bcb739475e444927 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 3 Sep 2021 09:48:24 +0200 Subject: [PATCH] * PostgreSQL/Addressbook/All Apps: fix SQL error in history tab if there are attachments --- api/src/Storage/History.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/Storage/History.php b/api/src/Storage/History.php index 3e6d778efb..fe32484ea2 100644 --- a/api/src/Storage/History.php +++ b/api/src/Storage/History.php @@ -308,7 +308,7 @@ class History $_query[] = array( 'table' => Api\Vfs\Sqlfs\StreamWrapper::TABLE, 'cols' => array('fs_id', 'fs_dir', "'filemanager'", 'COALESCE(fs_modifier,fs_creator)', "'~file~'", - 'fs_name', 'fs_modified', 'fs_mime', '"" AS share_email'), + 'fs_name', 'fs_modified', 'fs_mime', "'' AS share_email"), 'where' => array('fs_dir' => $file['ino']) ); } @@ -316,7 +316,8 @@ class History foreach($GLOBALS['egw']->db->union( $_query, __LINE__, __FILE__, - ' ORDER BY ' . ($query['order'] ? $query['order'] : 'history_timestamp') . ' ' . ($query['sort'] ? $query['sort'] : 'DESC'), + preg_match('/^(([a-z0-9_]+) (ASC|DESC),?)+$/', $query['order'].' '.($query['sort'] ?: 'DESC')) ? + ' ORDER BY ' . $query['order'] . ' ' . ($query['sort'] ?: 'DESC') : ' ORDER BY history_timestamp DESC,history_id ASC', $query['start'], $query['num_rows'] ) as $row)