From e908d5edb189a87caba9bc24ab069b997ccd9e51 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 27 Feb 2024 10:58:49 +0000 Subject: [PATCH] Fix: Upload's db fields, if given a string value would actually set the system path, rather than the value given. https://datatables.net/forums/discussion/78305 --- Editor/Upload.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Editor/Upload.php b/Editor/Upload.php index c531221..e30bef2 100644 --- a/Editor/Upload.php +++ b/Editor/Upload.php @@ -695,7 +695,18 @@ private function _dbExec($upload, $db) ->where($this->_dbPKey, $id); foreach ($pathFields as $column => $type) { - $q->set($column, $type === self::DB_WEB_PATH ? $webPath : $path); + if ($type === self::DB_WEB_PATH) { + $q->set($column, $webPath); + } + else if ($type === self::DB_SYSTEM_PATH) { + $q->set($column, $path); + } + else if (is_string($type)) { + $q->set($column, str_replace('__ID__', $id, $type)); + } + else { + $q->set($column, $type); + } } $q->exec();