Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode.env.openExternal - Inconsistent URL encoding between open and copy options #242569

Closed
bmingles opened this issue Mar 4, 2025 · 3 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) uri

Comments

@bmingles
Copy link

bmingles commented Mar 4, 2025

Type: Bug

When using the vscode.env.openExternal api in an extension, URLs are inconsistently encoded between the "Open" and "Copy" options.

It looks like the copy feature is passing skipEncoding = true to Uri.toString().

this._clipboardService.writeText(typeof originalResource === 'string' ? originalResource : resourceUri.toString(true));

Presumably the code that opens the link may not be doing the same?

Steps to Reproduce

const url = new URL('https://www.google.com/search');
url.searchParams.append('q', encodeURIComponent('x+y'));
vscode.env.openExternal(vscode.Uri.parse(url.toString()));

A dialog opens asking "Do you want Code to open the external website?"

Image

Expected Results

Clicking the "Open" button should produce the same URL as clicking "Copy"

Actual Results

Clicking the "Open" button seems to have different URI encoding than the link provided by "Copy"

VS Code version: Code 1.97.2 (Universal) (e54c774, 2025-02-12T23:20:35.343Z)
OS version: Darwin arm64 24.3.0
Modes:
Remote OS version: Linux x64 5.14.0-503.21.1.el9_5.x86_64

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 3, 3
Memory (System) 64.00GB (18.96GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote SSH: jxn-saml-sanluis.int.illumon.com
OS Linux x64 5.14.0-503.21.1.el9_5.x86_64
CPUs AMD EPYC 7B13 (8 x 0)
Memory (System) 62.29GB (45.95GB free)
VM 0%
Extensions (42)
Extension Author (truncated) Version
vscode-sqlite ale 0.14.1
tsl-problem-matcher amo 0.6.2
astro-vscode ast 2.15.4
color-info bie 0.7.2
ruff cha 2025.14.0
path-intellisense chr 2.10.0
esbuild-problem-matchers con 0.0.3
vscode-eslint dba 3.0.10
vscode-deephaven dee 0.1.26
gitlens eam 16.3.2
RunOnSave eme 0.2.7
prettier-vscode esb 11.0.0
copilot Git 1.275.0
copilot-chat Git 0.24.1
vscode-pull-request-github Git 0.104.1
go gol 0.46.0
vscode-drawio hed 1.9.0
rest-client hum 0.25.1
rainbow-csv mec 3.17.0
code-point med 1.12.0
vscode-scss mrm 0.10.0
vscode-docker ms- 1.29.4
vscode-dotnet-runtime ms- 2.2.8
playwright ms- 1.1.13
debugpy ms- 2025.0.1
python ms- 2025.0.0
vscode-pylance ms- 2025.2.1
jupyter ms- 2025.1.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
remote-containers ms- 0.397.0
remote-ssh ms- 0.117.1
remote-ssh-edit ms- 0.87.0
remote-explorer ms- 0.4.3
vscode-github-issue-notebooks ms- 0.0.130
vscode-versionlens pfl 1.16.2
LiveServer rit 5.7.9
vscode-stylelint sty 1.4.0
react-ts-css vii 3.2.7
explorer vit 1.16.0

(1 theme extensions excluded)

Copy link

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2025
@bmingles
Copy link
Author

bmingles commented Mar 5, 2025

@jrieken I don't see this specific issue (mismatch between copy / open) represented in the other URI related tickets. Can you provide any more details as to why this was marked as a duplicate?

@mofojed
Copy link

mofojed commented Mar 6, 2025

Looks like this is related to a previous fix that needed to be reverted due to extensions relying on broken behaviour: #140907 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*duplicate Issue identified as a duplicate of another issue(s) uri
Projects
None yet
Development

No branches or pull requests

4 participants