I am trying to implement an “Open in VSCode” button in a front end.
For our CLI tooling, we use this:
code --disable-workspace-trust --folder-uri "vscode-remote://k8s-container+context=<context>+podname=<podname>+namespace=default+name=<image-name>+image=<ecr-address.com>%2F<ecr>%3A<img>/mnt/workspace"
And that works fine, opening up the k8s pod to the right container and workspace.
I’m trying to do nearly exactly the same thing as an <a href={url}> </a>
link tag in the front end where the link looks like this:
vscode://vscode-remote://k8s-container+context=<context>+podname=<podname>+namespace=default+name=<image-name>+image=<ecr-address.com>%2F<ecr>%3A<img>/mnt/workspace
But even though the :
and the /
are escaped, the URL seems to still be taking me to the //mnt/workspace directory which errors out because it doesn’t exist.
- The terminal process failed to launch: Starting directory (cwd) “/:/mnt/workspace” does not exist.
- Workspace does not exist Please select another workspace to open.
I tried escaping the image_url in JS
const encodedImageUrl = encodeURIComponent(env.primaryImageUrl);
Which I expected would work to make the image_url not be read as part of the full URL since it’s a parameter
Is there anything I’m missing in JS or Chrome perhaps that could be causing this?
Pam Gluss is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.