Live Preview can generate malformed URLs for absolute links and workspace paths
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- web-dev
Research direction
Start by inspecting WebviewComm.constructAddress and Connection.getFileRelativeToWorkspace, focusing on absolute HTTP(S) inputs and workspace roots with trailing separators. Reproduce both malformed URL cases, then run or extend the regression tests mentioned in the issue. Done means absolute URLs remain unchanged and local preview paths always have a slash after the port.
Written by the indexing model from the issue text.
Description
Bug
Live Preview can generate malformed preview URLs in two related cases:
- Absolute HTTP(S) URLs can be prefixed with the preview host, producing URLs such as
http://127.0.0.1:3000/http://example.test/page.htmland, depending on the caller-provided value,http://http://.... - Workspace-relative paths can be returned without a leading slash when the workspace root already ends with a path separator, producing a URL with the path joined directly after the port, e.g.
http://127.0.0.1:3000index.html.
Expected behavior
- Absolute
http://andhttps://URLs should be preserved as absolute URLs. - Preview paths served from the local Live Preview host should include
/after the port.
Actual behavior
- Absolute HTTP(S) URLs can be treated as local preview paths and receive another host/protocol prefix.
- In trailing-separator workspace cases, the path can be appended immediately after the port.
Environment
- Extension: Live Preview 0.4.18 local build, also observed while testing 0.4.19 install behavior
- OS: Windows
- Workspace type involved in repro: local/network workspace path where the resolved workspace root can include a trailing separator
Proposed fix
I have a small fix and regression tests ready in branch dknn:codex/fix-live-preview-url-normalization:
- preserve absolute
http://andhttps://URL inputs inWebviewComm.constructAddress - ensure
Connection.getFileRelativeToWorkspacereturns a leading slash for workspace-relative paths
- Dominant language
- TypeScript
- Stars
- 596
- Forks
- 119
- Avg merge
- 1d 4m
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-livepreview
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/vscode-livepreview#822 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/vscode-livepreview#744 · 1 comment ·
-
microsoft/vscode-livepreview#874 · 1 reaction · 2 assignees ·
-
[Feature Request] Allow Codex CLI to automatically start Live Preview for a specified HTML file Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
microsoft/vscode-livepreview#868 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/vscode-livepreview#862 · 2 comments ·
All issues in microsoft/vscode-livepreview
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100