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://file// links no longer working #197319

Closed
jonsterling opened this issue Nov 3, 2023 · 19 comments
Closed

vscode://file// links no longer working #197319

jonsterling opened this issue Nov 3, 2023 · 19 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders regression Something that used to work is now broken verified Verification succeeded workbench-os-integration Native OS integration issues
Milestone

Comments

@jonsterling
Copy link

jonsterling commented Nov 3, 2023

Type: Bug

All of a sudden, vscode://file// links are no longer working.

Expected behavior:

I click open a link like vscode://file//path-to-a-file-that-really-exists and it then VS Code opens the file. This has always worked for me.

Actual behavior:

I click open a link like vscode://file//path-to-a-file-that-really-exists and it then VS Code becomes focused, but it does not open the desired file.

Please note that I have verified that the file really does exist in the specified path.

VS Code version: Code 1.84.0 (Universal) (d037ac0, 2023-11-01T11:30:19.406Z)
OS version: Darwin arm64 23.0.0
Modes:

System Info
Item Value
CPUs Apple M1 (8 x 24)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.14GB free)
Process Argv --disable-extensions --crash-reporter-id f43891bf-1e90-4f74-a11c-73425109d857
Screen Reader no
VM 0%
Extensions disabled
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30880072
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
89544117:30613380
2i9eh265:30646982
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30869155
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pythonmypyd1:30879173
pythoncet0:30874138
pythontbext0:30879054

@jonsterling
Copy link
Author

To add more confusion to things, after ten minutes of behaving the way I described, VS Code started correctly opening these links. There must be some kind of intermittent bug, but I don't know how to reproduce it. Let me know if you have anything you'd like me to try on my machine.

@bpasero
Copy link
Member

bpasero commented Nov 3, 2023

@jonsterling we did change something in that area, see https://code.visualstudio.com/updates/v1_84#_confirmation-for-opening-protocol-links

I wonder why you would not see a dialog opening. Do you have VS Code running with no window opened maybe?

A similar issue was reported in #197263

@bpasero bpasero added the info-needed Issue requires more information from poster label Nov 3, 2023
@BernhardBaumrock
Copy link

waa. same here! I get the dialog that asks me to confirm to open the link in vscode but then vscode flickers once and does nothing. this is really an issue for me so I'd be grateful for a quick fix 🤯

@bpasero
Copy link
Member

bpasero commented Nov 3, 2023

I need to know if everyone sees the dialog and then it does not work or if some people do not see the dialog and some do and then it still does not work?

@bpasero
Copy link
Member

bpasero commented Nov 3, 2023

Also, can people try to reproduce in insiders?

@jonsterling
Copy link
Author

jonsterling commented Nov 3, 2023 via email

@bpasero
Copy link
Member

bpasero commented Nov 4, 2023

Please see if you can find any logged output that could help us find the source of the issue:

  • run code --verbose from the command line
  • reproduce the issue
  • attach the log files you find from running the command "Open Logs Folder"

Thanks!

@bpasero
Copy link
Member

bpasero commented Nov 5, 2023

I just realised: URLs of the form vscode://file//Users/bpasero/Desktop/test-js/package.json are not valid. They have to be vscode://file/Users/bpasero/Desktop/test-js/package.json, so I think this issue is addressable by making sure the URL is valid.

@bpasero bpasero closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2023
@jonsterling
Copy link
Author

jonsterling commented Nov 5, 2023

@bpasero That's a good catch! I'll make sure to fix my tool that is producing these bad links. But I think it is certainly not acceptable to close the ticket on this basis, for the following reasons:

  1. At least one other person (@BernhardBaumrock) has had the same issue, and we have not verified that Bernhard had an invalid URI. @BernhardBaumrock can you comment?

  2. The invalid URIs on my end were intermittently working: this strongly suggests that the invalid protocol was not the reason that they sometimes worked and sometimes didn't work. It sounds much more likely to be the case that VS Code was (perhaps overgenerously) handling the bad URIs, but that a different bug has caused the handling to work only intermittently. We can only find out by waiting to see if other people who are reproducing this bug had invalid URIS, or if they had valid URIs.

Therefore, it is clear that more investigation is required, as all signs point to my invalid URIs as being a red herring and there still being a legitimate bug. (Especially considering the fact that you have changed code in this area recently.) For that reason, I expect you will re-open this ticket...

@bpasero bpasero reopened this Nov 5, 2023
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug workbench-os-integration Native OS integration issues and removed info-needed Issue requires more information from poster new release labels Nov 5, 2023
@bpasero bpasero added this to the November 2023 milestone Nov 5, 2023
@BernhardBaumrock
Copy link

I've had file// links instead of file/ - it seems that everything is working again now :)

@bpasero
Copy link
Member

bpasero commented Nov 5, 2023

Yeah, there is changes needed in VS Code, esp. since now the behaviour is different between having the confirmation setting enabled or not.

I understand now how we are able to support even invalid URL like that because we process each path to open and normalise it, that probably removes the double slashes:

export function sanitizeFilePath(candidate: string, cwd: string): string {

Nevertheless, if you can change your tool to produce correct URLs, that would help people until the fix has landed 👍

@jonsterling
Copy link
Author

@bpasero Thanks! I've now fixed my tool to produce the correct links.

@bpasero bpasero added the regression Something that used to work is now broken label Nov 5, 2023
@bpasero bpasero closed this as completed in 25ba16e Nov 6, 2023
@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Nov 6, 2023
@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Nov 7, 2023
@bpasero bpasero added the author-verification-requested Issues potentially verifiable by issue author label Nov 7, 2023
@vscodenpa
Copy link

This bug has been fixed in the latest release of VS Code Insiders!

@jonsterling, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version c97d74f of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

@jonsterling
Copy link
Author

/verified

Everything is working correctly now! I can't say for sure that it is fixed because I could not reliably reproduce the bug before, but I trust that the change has solved the problem. Will follow up later if I encounter any other issues. thanks very much for your quick attention to this issue!

@benjaffe
Copy link

@bpasero How can I find out when this fix will hit a stable release? (My team uses click-to-react-component and this bug is causing friction for our front-end team, but I don't want to ask them to upgrade to insiders)

@bpasero
Copy link
Member

bpasero commented Nov 10, 2023

Our next stable release will happen in the first week of December.

To clarify: this is a bug in the application that produces these links, so maybe its easier to fix the application that produces the links.

@benjaffe
Copy link

benjaffe commented Nov 10, 2023 via email

andrewnicols added a commit to andrewnicols/whoops that referenced this issue Nov 16, 2023
The format of links for vscode is currently set to:

    vscode://file/{$file}:{$line}

This leads to URIs such as:

    vscode://file//Users/example/git/example.php

However vscode expects URIs in the format:

    vscode://file/Users/example/git/example.php

That is to say that the URI should be immediately after the `file`.

The correct URI format is:

    vscode://file{$file}:{$line}

See microsoft/vscode#197319 for more
information.
@andrewnicols
Copy link

It's worth noting that the documentation for this feature is not entirely clear.

https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls

The documentation state:

Open a file

vscode://file/{full path to file}

vscode://file/c:/myProject/package.json

Open a file to line and column

vscode://file/{full path to file}:line:column

vscode://file/c:/myProject/package.json:5:10

However on a *nix-like system the {full path to file} would be /some/example/here making the documented URI vscode://file//some/example/here which we are now told is incorrect.

I would argue that this is therefore not a bug in the generating code, but actually in vscode (which is now fixed).

Whilst working around this in the generating code is possiblem I would suggest that it is not correct in the long term.

@edalzell
Copy link

I need to know if everyone sees the dialog and then it does not work or if some people do not see the dialog and some do and then it still does not work?

do not see the dialog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders regression Something that used to work is now broken verified Verification succeeded workbench-os-integration Native OS integration issues
Projects
None yet
Development

No branches or pull requests

8 participants