Skip to content

VSCE patch release - 2.2.2 - fix file path bug on windows, display version number, remove basePath restriction

Warren Gifford requested to merge bee/vsce-fix-links into main

Created by: abeatrix

This PR closes:

Summary

As reported by a user in https://github.com/sourcegraph/sourcegraph/issues/34630, the "Open file in Sourcegraph Web" option from Windows VSCode fails. After looking more into this issue, I can confirm that this issue happens to both "Open file in Sourcegraph Web" and "Copy link to Sourcegraph" functions when running with local files.

A patch release 2.2.2 will be published after this PR is closed.

Root cause

I suspect this is because the file path format on Windows uses \ which is not supported by any Sourcegraph instances, so when we generate a Sourcegraph URL using the file path retrieved from windows machine, the current implementation would return a sourcegraph url with forward slashes in the file path.

For example, the copied URL showsfile=schema\bitbucket_cloud.schema.json from https://sourcegraph.com/-/editor?remote_url=https://github.com/abeatrix/sourcegraph.git&branch=main&file=schema\bitbucket_cloud.schema.json&editor=VSCode&version=2.2.1&start_row=28&start_col=30&end_row=28&end_col=30&utm_campaign=vscode-extension&utm_medium=direct_traffic&utm_source=vscode-extension&utm_content=vsce-commands

As a result, trying to open the link would redirect user to a 404 page because of the file path: Image

Solution in the PR

Changing the double \ into / would take me to the correct page: Image

Current Workaround

Current workaround would be replace all the \\ with / in the final URL using the sourcegraph.remoteUrlReplacements setting

Test plan

Package built from this PR fixes all the listed issue.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading