From 0afcce2fcdf03a6ff3aa1d179735d29f65bf2f30 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 26 Oct 2023 16:00:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6=20mysql=20=E9=9D=9E?= =?UTF-8?q?=E6=B3=95=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/datasource/MysqlConfiguration.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java b/core/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java index 6a22b778f0..ffffeaf3c6 100644 --- a/core/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java +++ b/core/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java @@ -14,26 +14,19 @@ public class MysqlConfiguration extends JdbcConfiguration { private String driver = "com.mysql.jdbc.Driver"; private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull"; - private List illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations"); + private List illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations", "allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath"); public String getJdbc() { if (StringUtils.isEmpty(extraParams.trim())) { - return "jdbc:mysql://HOSTNAME:PORT/DATABASE" - .replace("HOSTNAME", getHost().trim()) - .replace("PORT", getPort().toString().trim()) - .replace("DATABASE", getDataBase().trim()); + return "jdbc:mysql://HOSTNAME:PORT/DATABASE".replace("HOSTNAME", getHost().trim()).replace("PORT", getPort().toString().trim()).replace("DATABASE", getDataBase().trim()); } else { for (String illegalParameter : illegalParameters) { - if (getExtraParams().contains(illegalParameter)) { + if (getExtraParams().toLowerCase().contains(illegalParameter.toLowerCase())) { throw new RuntimeException("Illegal parameter: " + illegalParameter); } } - return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS" - .replace("HOSTNAME", getHost().trim()) - .replace("PORT", getPort().toString().trim()) - .replace("DATABASE", getDataBase().trim()) - .replace("EXTRA_PARAMS", getExtraParams().trim()); + return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS".replace("HOSTNAME", getHost().trim()).replace("PORT", getPort().toString().trim()).replace("DATABASE", getDataBase().trim()).replace("EXTRA_PARAMS", getExtraParams().trim()); } } } \ No newline at end of file