consoleview: fix handling of undefined URL strings
PATCH v2 1/1 consoleview: fix handling of undefined URL strings
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 <[email protected]>
---
Changes in v2:
- Trying to fix the whole logic instead of just skipping undefined
values.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- .../src/views/ConsoleView/ConsoleView.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
yocto_console_view/src/views/ConsoleView/ConsoleView.tsx +12 -10
@@ -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";
---
base-commit: fdc34623463b1c708220021649ba4b8b53db3dbf
change-id: 20251108-mathieu-fix-url-replace-7f62a4fa56b0
Best regards,
Signature · 1 line
Mathieu Dubois-Briand <[email protected]>