fix(app): decode imported connection link names (#1930)

Co-authored-by: zero <zero@zeroMacmini.local>
This commit is contained in:
LRcodingandzero authored and GitHub committed 2026-06-26 16:09:17 +08:00
1 parent 2aba40ecb7
commit f963a6e793
5 files changed
+87 -5

No files matched your search

@@ -24,7 +24,7 @@ import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
import * as api from "@/lib/api";
import { isTauriRuntime } from "@/lib/tauriRuntime";
import { applyParsedConnectionUrl, normalizeMongoConnectionString, parseConnectionUrl } from "@/lib/connectionUrl";
import type { ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink";
import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink";
import { connectionUrlPlaceholder as getUrlPlaceholder } from "@/lib/connectionPresentation";
import { h2ConnectionModeForConfig, h2FileJdbcUrl, h2FilePathFromJdbcUrl, type H2ConnectionMode } from "@/lib/h2Connection";
import { firstZooKeeperEndpoint, normalizeZooKeeperConnectString } from "@/lib/zookeeperConnection";
@@ -1464,6 +1464,12 @@ async function testConnection() {
function applyConnectionUrlToForm(input: string): boolean {
try {
const draft = parseConnectionDeepLink(input);
if (draft) {
applyConnectionDraftToForm({ ...draft, oneTime: undefined });
return true;
}
const parsed = parseConnectionUrl(input, selectedType.value);
form.value = applyParsedConnectionUrl(form.value, parsed);
selectedType.value = parsed.driverProfile;
@@ -2146,8 +2152,7 @@ function submitOneTimePrefill(draft: ConnectionDeepLinkDraft) {
void nextTick(() => save());
}
function applyConnectionPrefill(draft: ConnectionDeepLinkDraft) {
resetForm();
function applyConnectionDraftToForm(draft: ConnectionDeepLinkDraft) {
applyProfile(draft.driverProfile);
form.value = {
...form.value,
@@ -2183,6 +2188,11 @@ function applyConnectionPrefill(draft: ConnectionDeepLinkDraft) {
dialogStep.value = "config";
configTab.value = "connection";
resetTestState();
}
function applyConnectionPrefill(draft: ConnectionDeepLinkDraft) {
resetForm();
applyConnectionDraftToForm(draft);
submitOneTimePrefill(draft);
}