microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.62k forks source link

Uri in command uri incorrectly transformed in remote case #226348

Open mjbvz opened 3 weeks ago

mjbvz commented 3 weeks ago

Looks like our remote uri transformer kicks in incorrectly for command uris that take uris as arguments:

  1. Using an extension running in a remote workspace (make sure it's running on the workspace side, not the UI side)
  2. On the remote: start with a file: uri from the workspace.
  3. On the remote: create a command uri that takes the file uri from step 2 as an argument.
  4. On the UI: User triggers the command URI from step 3 by clicking a markdown link in the UI.
  5. On the remote: The command is executed. 🐛 However in the arguments we get a vscode-local uri instead of the file uri created in step 2

This can happen for command uris used in markdown strings, as well as those used in document links and other parts of the UI

mjbvz commented 3 weeks ago

Two options to workaround this by preventing the transformed from kicking in:

  1. Pass the uri as a string instead of as an actualy actual
  2. Delete the internal $mid property off of the uri when passing it as an argument:
({ ....uri.toJSON(), $mid: undefined })
jrieken commented 3 weeks ago

transformer kicks in incorrectly for command uris that take uris as arguments:

It doesn't kick in at all because we don't "look" for uris in that case