From ec3754cf40fe7ff69dbbc0ca9ade24e846ce8887 Mon Sep 17 00:00:00 2001 From: shanevcantwell <153727980+shanevcantwell@users.noreply.github.com> Date: Thu, 12 Mar 2026 17:27:24 -0600 Subject: [PATCH 1/3] fix: terminal URL link detection now captures port numbers in IP addresses The link regex was designed for domain names and broke on IP:port URLs like http://192.168.137.1:8081, only linkifying up to the IP without the port. Simplified the http/https branch to match everything after the protocol until whitespace. Closes #11368 Co-Authored-By: Claude Opus 4.6 --- .../components/UnifiedTerminal/UnifiedTerminal.test.tsx | 7 +++---- gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx index 55420628fc9..9d88f92a64d 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx @@ -27,7 +27,8 @@ const MOCK_ANSI_OUTPUT = `\u001b[32m✓\u001b[0m Test passed const MOCK_OUTPUT_WITH_LINKS = `Build successful! Visit https://example.com for more info Check www.github.com/user/repo -Error logs at file:///tmp/error.log`; +Error logs at file:///tmp/error.log +Available on: http://192.168.137.1:8081`; // Mock the redux hooks const mockDispatch = vi.fn(); @@ -200,9 +201,7 @@ describe("UnifiedTerminalCommand", () => { // Should contain the link text in the output expect(container.textContent).toMatch(/https:\/\/example\.com/); expect(container.textContent).toMatch(/www\.github\.com/); - - // Note: Link detection might create actual tags or just display the URLs - // The important thing is the URLs are visible in the output + expect(container.textContent).toMatch(/http:\/\/192\.168\.137\.1:8081/); }); test("shows copy and run in terminal buttons when not running", async () => { diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx index f048af8fb36..20291708a38 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx @@ -176,7 +176,7 @@ function convertBundleIntoReact( const content: React.ReactNode[] = []; const linkRegex = - /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g; + /(\s|^)(https?:\/\/[^\s]+|www\.[^\s]+\.[^\s]{2,})/g; let index = 0; let match: RegExpExecArray | null; From fa42c9e7f3f74f89ed4c893e6a798a23daa7750f Mon Sep 17 00:00:00 2001 From: shanevcantwell <153727980+shanevcantwell@users.noreply.github.com> Date: Thu, 12 Mar 2026 17:49:40 -0600 Subject: [PATCH 2/3] test: validate link href attributes in terminal URL test The text-only assertion wouldn't catch a regression where the URL appears in output but the href is truncated (e.g. missing port). Co-Authored-By: Claude Opus 4.6 --- gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx index 9d88f92a64d..e6ea5eea8ff 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx @@ -202,6 +202,12 @@ describe("UnifiedTerminalCommand", () => { expect(container.textContent).toMatch(/https:\/\/example\.com/); expect(container.textContent).toMatch(/www\.github\.com/); expect(container.textContent).toMatch(/http:\/\/192\.168\.137\.1:8081/); + + // Verify rendered links have correct hrefs including port + const links = container.querySelectorAll("a"); + const hrefs = Array.from(links).map((a) => a.getAttribute("href")); + expect(hrefs).toContainEqual("https://example.com"); + expect(hrefs).toContainEqual(expect.stringContaining("192.168.137.1:8081")); }); test("shows copy and run in terminal buttons when not running", async () => { From 193f66d64f71faec7f41db4dd19ae15213f939e9 Mon Sep 17 00:00:00 2001 From: shanevcantwell <153727980+shanevcantwell@users.noreply.github.com> Date: Thu, 12 Mar 2026 18:19:32 -0600 Subject: [PATCH 3/3] style: fix prettier formatting on link regex Co-Authored-By: Claude Opus 4.6 --- gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx index 20291708a38..34e72584ab6 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx @@ -175,8 +175,7 @@ function convertBundleIntoReact( } const content: React.ReactNode[] = []; - const linkRegex = - /(\s|^)(https?:\/\/[^\s]+|www\.[^\s]+\.[^\s]{2,})/g; + const linkRegex = /(\s|^)(https?:\/\/[^\s]+|www\.[^\s]+\.[^\s]{2,})/g; let index = 0; let match: RegExpExecArray | null;