diff mbox series

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

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

Commit Message

Mathieu Dubois-Briand Nov. 10, 2025, 9:55 a.m. UTC
Some errors were observed on the console view when the URL string is
undefined. Just mask URLs in such case, as it would otherwise lead to a
JS exception.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
Changes in v2:
- Trying to fix the whole logic instead of just skipping undefined
  values.
- Link to v1: https://lore.kernel.org/r/20251108-mathieu-fix-url-replace-v1-1-ce0c804c3d1e@bootlin.com
---
 .../src/views/ConsoleView/ConsoleView.tsx          | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)


---
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..14276ce92da9 100644
--- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
+++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
@@ -185,16 +185,16 @@  function selectChangeForBuild(build: Build, buildset: Buildset,
         oecore_revision = build.properties['commit_oecore'][0];
       }
       if ('repo_oecore' in build.properties) {
-        oecore_repo = build.properties['repo_oecore'][0];
+        oecore_repo = getHttpURL(build.properties['repo_oecore'][0]);
       }
       if ('commit_oecore' in build.properties) {
         bitbake_revision = build.properties['commit_bitbake'][0];
       }
       if ('repo_bitbake' in build.properties) {
-        bitbake_repo = build.properties['repo_bitbake'][0];
+        bitbake_repo = getHttpURL(build.properties['repo_bitbake'][0]);
       }
       if ('repo_poky' in build.properties) {
-        poky_repo = build.properties['repo_poky'][0];
+        poky_repo = getHttpURL(build.properties['repo_poky'][0]);
       }
       if ('use_bitbake_setup' in build.properties) {
         use_bitbake_setup = build.properties['use_bitbake_setup'][0];
@@ -220,20 +220,22 @@  function selectChangeForBuild(build: Build, buildset: Buildset,
         change.change.caption = branchMapping[build.buildid];
       }
 
-      oecore_repo = getHttpURL(oecore_repo);
-      bitbake_repo = getHttpURL(bitbake_repo);
-      poky_repo = getHttpURL(poky_repo);
-
       if (!use_bitbake_setup) {
-        change.change.poky_revlink = poky_repo + "/commit/?id=" + revision;
+        if (poky_repo !== undefined) {
+          change.change.poky_revlink = poky_repo + "/commit/?id=" + revision;
+        }
         change.change.poky_revision = revision;
         change.change.errorlink = "http://errors.yoctoproject.org/Errors/Latest/?filter=" + revision + "&type=commit&limit=150";
       } else {
         // We might retrieve the "use_bitbake_setup" after the first execution, so wrong poky data might have been added: remove them.
         change.change.poky_revlink = change.change.poky_revision = undefined;
 
-        change.change.oecore_revlink = oecore_repo + "/commit/?id=" + oecore_revision;
-        change.change.bitbake_revlink = bitbake_repo + "/commit/?id=" + bitbake_revision;
+        if (oecore_repo !== undefined) {
+          change.change.oecore_revlink = oecore_repo + "/commit/?id=" + oecore_revision;
+        }
+        if (bitbake_repo !== undefined) {
+          change.change.bitbake_revlink = bitbake_repo + "/commit/?id=" + bitbake_revision;
+        }
         change.change.oecore_revision = oecore_revision;
         change.change.bitbake_revision = bitbake_revision;
         change.change.errorlink = "http://errors.yoctoproject.org/Errors/Latest/?filter=" + oecore_revision + "&type=commit&limit=150";