diff mbox series

[yocto-autobuilder2] consoleview: fix handling of undefined URL strings

Message ID 20251108-mathieu-fix-url-replace-v1-1-ce0c804c3d1e@bootlin.com
State New
Headers show
Series [yocto-autobuilder2] consoleview: fix handling of undefined URL strings | expand

Commit Message

Mathieu Dubois-Briand Nov. 8, 2025, 2:31 p.m. UTC
Some errors were observed on the console view when the URL string is
undefined. Reason for undefined URLs is unexplained so far, but we
should at least try to not generate any JS exception.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 yocto_console_view/src/views/ConsoleView/ConsoleView.tsx | 4 ++++
 1 file changed, 4 insertions(+)


---
base-commit: fdc34623463b1c708220021649ba4b8b53db3dbf
change-id: 20251108-mathieu-fix-url-replace-7f62a4fa56b0

Best regards,
diff mbox series

Patch

diff --git a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
index 16569ea9eac8..a30402a9a335 100644
--- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
+++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
@@ -156,6 +156,10 @@  const gitHostAliases = new Map([
 
 function getHttpURL(url)
 {
+       if (url === undefined) {
+               return url;
+       }
+
        let u = new URL(url.replace(RegExp("^[a-z]*://"), "https://"));
        u.username = "";
        if (gitHostAliases.has(u.host)) {