microsoft / microsoft/vscode-livepreview

Live Preview omits initial slash of URL pathname if `livePreview.openPreviewTarget` is "External Browser" and `livePreview.serverRoot` ends with a slash.

Open Beginner friendly
#744 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
596
Forks
119
Avg merge
1d 4m
Merged PRs (30d)
5

Description

  • Live Preview version: 0.4.15
  • VS Code version: 1.101.1
  • OS version: macOS 15.5

Steps to Reproduce:

  1. Create or open a workspace.
  2. Create a folder in the workspace root such as "public".
  3. In the workspace settings, set livePreview.serverRoot to that folder's path with a trailing slash (e.g. "/public/").
  4. In the workspace or user settings, set livePreview.openPreviewTarget to "External Browser".
  5. Create or open an HTML file in the folder from step 2 such as /public/index.html.
  6. Open a preview of that file.

Expected result: VS Code tells the default browser to open http://127.0.0.1:3000/index.html.

Actual result: VS Code tells the default browser to open http://127.0.0.1:3000index.html/.
(See screenshot. Note the missing slash between port and filename, and the appended trailing slash.)

Screenshot of VS Code dialog asking "Do you want to open the external website?" and showing the malformed URL mentioned in the actual result, above. Options are "Open", "Copy", "Configure Trusted Domains", and "Cancel". The "domains" option exists because the missing slash causes the ".html" suffix to be interpreted as a top-level domain.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the URL construction used when livePreview.openPreviewTarget is "External Browser", reproducing the case with livePreview.serverRoot set to "/public/" and an index.html file. Done means the external browser receives http://127.0.0.1:3000/index.html, with neither the missing slash nor the appended trailing slash.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.