fix(hosting): use dynamic hostname for external link#1141
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the hosting emulator card link to dynamically construct the URL using the current window's hostname and the hosting port via the hostAndPort helper. Feedback was provided regarding IPv6 addresses, where window.location.hostname already contains square brackets, potentially leading to an invalid URL (e.g., //[[::1]]:5000/). It is recommended to strip any existing square brackets from the hostname before passing it to hostAndPort.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
Fixes #1140
Type of Change
How Has This Been Tested?
npm test, all tests passed successfully.The Solution
Instead of relying on the static
config.hosting.hostAndPortfor external navigation, this change dynamically passeswindow.location.hostnameinto thehostAndPorthelper directly within the component.