Vscode-vsce: Extension marketplace readme renderer assumes you're using branch called master

Created on 20 Jul 2020  路  3Comments  路  Source: microsoft/vscode-vsce




  • VSCode Version: 1.47.2
  • OS Version: Windows 10 1903

Steps to Reproduce:

  1. Create a new extension with links to images in its README.md file

For example,

![some image](./images/some-image.png)
  1. Publish the extension

Expected

Images work

Actual

Images appear to link to i.e. https://github.com/user/extension/raw/master/images/some-image.png

If, for example, your default branch is called main then this means that all the images are broken.

This also assumes that the extension lives at the root of the repo; this will break in the event that an extension is in a subfolder.


Does this issue occur when all extensions are disabled?: Yes

Workaround

Directly link to the images in the GitHub repo. Don't have relative image paths in your extension's README.md.

bug verified

All 3 comments

Yeah

Looks like master is hardcoded here...
https://github.com/microsoft/vscode-vsce/blob/96e7e42bb43d8c3beab88de924310997e73fda14/src/package.ts#L515-L516

@joaomoreno what would be the appropriate fix here? We could have it call the GitHub API to retrieve the default branch and use that. We could also add a new flag like githubBranch so users can directly override the branch for GitHub base URLs.

If a githubBranch option was added, it would also be nice to have a way to set the repositoryName to something to support extensions that aren't at the root of the repo (maybe extensionPath or something?)

Was this page helpful?
0 / 5 - 0 ratings