From 1389b9a362806b7cdb3cbf47aecbb0aa8bea3918 Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:14:40 +0900 Subject: [PATCH 1/2] fix install url #1235 --- src/pages/install/App.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pages/install/App.tsx b/src/pages/install/App.tsx index 01c2817fc..bcd2e1f03 100644 --- a/src/pages/install/App.tsx +++ b/src/pages/install/App.tsx @@ -653,24 +653,21 @@ function App() { const hasValidSourceParam = !searchParamUrl && !!(searchParams.get("uuid") || searchParams.get("file")); const urlHref = useMemo(() => { - if (!hasValidSourceParam) { - let rawUrl; + if (searchParamUrl) { try { // 取url=之后的所有内容 - rawUrl = location.search.match(/\?url=([^&]+)/)?.[1] || ""; - if (rawUrl) { - const urlObject = new URL(rawUrl); - // 验证解析后的 URL 是否具备核心要素,确保安全性与合法性 - if (urlObject.protocol && urlObject.hostname && urlObject.pathname) { - return rawUrl; - } + const rawUrl = location.search.match(/\?url=(.+)/)?.[1] || searchParamUrl; + const urlObject = new URL(rawUrl); + // 验证解析后的 URL 是否具备核心要素,确保安全性与合法性 + if (urlObject.protocol && urlObject.hostname && urlObject.pathname) { + return rawUrl; } } catch { // ignored } } return ""; - }, [hasValidSourceParam]); + }, [searchParamUrl]); const [fetchingState, setFetchingState] = useState({ loadingStatus: "", From d2d49db1d7c1ecb092c2f20166048c68650b61eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Mon, 16 Feb 2026 13:34:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8D=E7=94=A8=E6=AD=A3=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/install/App.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/install/App.tsx b/src/pages/install/App.tsx index bcd2e1f03..6bbb48d51 100644 --- a/src/pages/install/App.tsx +++ b/src/pages/install/App.tsx @@ -656,7 +656,8 @@ function App() { if (searchParamUrl) { try { // 取url=之后的所有内容 - const rawUrl = location.search.match(/\?url=(.+)/)?.[1] || searchParamUrl; + const idx = location.search.indexOf("url="); + const rawUrl = idx !== -1 ? location.search.slice(idx + 4) : searchParamUrl; const urlObject = new URL(rawUrl); // 验证解析后的 URL 是否具备核心要素,确保安全性与合法性 if (urlObject.protocol && urlObject.hostname && urlObject.pathname) {