diff --git a/electron/main/commons/index.ts b/electron/main/commons/index.ts index fa357ec..976802e 100644 --- a/electron/main/commons/index.ts +++ b/electron/main/commons/index.ts @@ -209,6 +209,9 @@ function analysisHTML(windowName: string, url: string, data: string) { let $ = cheerio.load(data); // 获取标题 result.name = $("head").find("title").text(); + if (!result.name || result.name.trim() === "") { + result.name = $("title").text(); + } // 获取图标URL let iconURL: string | null = null; let icon = $("link[rel='icon']"); @@ -272,6 +275,9 @@ function analysisHTML(windowName: string, url: string, data: string) { result.status = true; sendUrlInfo(windowName, result); } else { + if (result.name && result.name.trim() !== "") { + result.status = true; + } sendUrlInfo(windowName, result); } } diff --git a/src/pages/item/AddEdit.vue b/src/pages/item/AddEdit.vue index ab941d5..2dab776 100644 --- a/src/pages/item/AddEdit.vue +++ b/src/pages/item/AddEdit.vue @@ -833,8 +833,10 @@ onMounted(() => { getURLInfoLoading.value = false; let res: Result = data; if (res.status) { - form.data.icon = res.icon; - form.data.htmlIcon = null; + if (res.icon && res.icon.trim() !== "") { + form.data.icon = res.icon; + form.data.htmlIcon = null; + } form.name = res.name ?? ""; } else { window.api.showErrorMessageBox(