]> git.joonet.de Git - adminer.git/commitdiff
CSV import: Don't unquote " in unquoted values
authorJakub Vrana <jakub@vrana.cz>
Fri, 28 Feb 2025 13:40:31 +0000 (14:40 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 28 Feb 2025 13:40:31 +0000 (14:40 +0100)
adminer/select.inc.php

index 59dda2348ce8e84c156c128081089987e352d384..9c5dec8e5d9ccd2432cd528bffaaffed8d387ff2 100644 (file)
@@ -198,7 +198,7 @@ if ($_POST && !$error) {
                                } else {
                                        $set = array();
                                        foreach ($matches2[1] as $i => $col) {
-                                               $set[idf_escape($cols[$i])] = ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : q(str_replace('""', '"', preg_replace('~^"|"$~', '', $col))));
+                                               $set[idf_escape($cols[$i])] = ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : q(preg_match('~^".*"$~s', $col) ? str_replace('""', '"', substr($col, 1, -1)) : $col));
                                        }
                                        $rows[] = $set;
                                }