25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(connection): preserve Oracle JDBC credential characters (#11612)
zipg528ad2f62b0d
diff --git a/apps/desktop/src/lib/__tests__/connection/connectionUrlBuilder.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionUrlBuilder.spec.tsindex 5058a47c60..6a1d37bf1c 100644--- a/apps/desktop/src/lib/__tests__/connection/connectionUrlBuilder.spec.ts+++ b/apps/desktop/src/lib/__tests__/connection/connectionUrlBuilder.spec.ts@@ -175,6 +175,22 @@ describe("buildConnectionUrlCopy JDBC URL", () => {expect(parseConnectionUrl(text ?? "").password).toBe(password);});+ it("keeps Oracle Easy Connect credentials literal instead of URI-encoding them", () => {+ const oracle = config({ db_type: "oracle", host: "ora.example.com", port: 1521, database: "ORCLPDB1", password: "p^ss%40#y" });+ expect(buildConnectionUrlCopy(oracle, "jdbcUrlWithCredentials")).toBe("jdbc:oracle:thin:@//ora.example.com:1521/ORCLPDB1?user=app_user&password=p^ss%40#y");+ });++ it("does not offer an Oracle credential URL that would split a property", () => {+ const oracle = config({ db_type: "oracle", host: "ora.example.com", port: 1521, database: "ORCLPDB1", password: "p&ss" });+ expect(buildConnectionUrlCopy(oracle, "jdbcUrlWithCredentials")).toBeNull();+ expect(connectionUrlCopyFormats(oracle)).not.toContain("jdbcUrlWithCredentials");+ });++ it("does not offer an Oracle credential URL that would split at @", () => {+ const oracle = config({ db_type: "oracle", host: "ora.example.com", port: 1521, database: "ORCLPDB1", password: "p@ss" });+ expect(buildConnectionUrlCopy(oracle, "jdbcUrlWithCredentials")).toBeNull();+ });+it("redacts a percent-encoded password property name accepted by the MySQL importer", () => {const mysql = config({ db_type: "mysql", port: 3306, username: "", password: "", url_params: "pass%77ord=synthetic-secret&connectTimeout=5000" });const jdbcWithCredentials = buildConnectionUrlCopy(mysql, "jdbcUrlWithCredentials")!;diff --git a/apps/desktop/src/lib/connection/connectionUrlBuilder.ts b/apps/desktop/src/lib/connection/connectionUrlBuilder.tsindex 106440f62d..55084ff038 100644--- a/apps/desktop/src/lib/connection/connectionUrlBuilder.ts+++ b/apps/desktop/src/lib/connection/connectionUrlBuilder.ts@@ -292,6 +292,20 @@ function jdbcCredentialParams(config: ConnectionUrlCopyConfig, withCredentials:return params;}+/**+ * Oracle Easy Connect Plus properties are not URI query parameters. The+ * Oracle driver keeps percent escapes literal, so `^` must stay `^` rather+ * than becoming `%5E`. Values containing property delimiters cannot be+ * represented safely in the generated URL and are rejected by the caller.+ */+function oracleJdbcCredentialValue(value: string): string {+ return value;+}++function oracleJdbcCredentialCanBeEmbedded(value: string): boolean {+ return !/[&=@\s\\"]/.test(value);+}+/*** Dialects whose JDBC URL is not `prefix://host:port/db?query`.* Returns `undefined` when the type is not a special dialect, `null` when the@@ -313,7 +327,8 @@ function buildSpecialJdbcUrl(config: ConnectionUrlCopyConfig, database: string,const host = config.host?.trim() ?? "";const rawParams = (config.url_params ?? "").trim();const propertyStyle = config.db_type === "sqlserver" || config.db_type === "teradata" ? config.db_type : null;- const credentials = jdbcCredentialParams(config, withCredentials, propertyStyle ? (value) => quoteJdbcProperty(value, propertyStyle) : encodeURIComponent);+ if (config.db_type === "oracle" && withCredentials && [effectiveUsername(config), config.password ?? ""].some((value) => value && !oracleJdbcCredentialCanBeEmbedded(value))) return null;+ const credentials = jdbcCredentialParams(config, withCredentials, propertyStyle ? (value) => quoteJdbcProperty(value, propertyStyle) : config.db_type === "oracle" ? oracleJdbcCredentialValue : encodeURIComponent);switch (config.db_type) {case "sqlserver": {