diff --git a/news/changelog-1.3.md b/news/changelog-1.3.md index 3209fe39f1..202bfdd1bd 100644 --- a/news/changelog-1.3.md +++ b/news/changelog-1.3.md @@ -54,6 +54,10 @@ - Remove chapter number of HTML head title when `number-sections` is `false` (#3304). +## Preview + +- Correct redirect for VS Code Server (#3352) (Thank you, @benz0li!) + ## Miscellaneous - Work around pandoc strict checking of `number-offset` type. ([#3126](https://github.com/quarto-dev/quarto-cli/issues/3126)) diff --git a/src/command/preview/preview.ts b/src/command/preview/preview.ts index 35edcb27db..f8e096b08a 100644 --- a/src/command/preview/preview.ts +++ b/src/command/preview/preview.ts @@ -72,6 +72,8 @@ import { isJupyterHubServer, isRStudioServer, isRStudioWorkbench, + isVSCodeServer, + vsCodeServerProxyUri, } from "../../core/platform.ts"; import { isJupyterNotebook } from "../../core/jupyter/jupyter.ts"; import { watchForFileChanges } from "../../core/watch.ts"; @@ -690,6 +692,9 @@ function pdfFileRequestHandler( if (new URL(req.url).pathname === "/") { const url = isRStudioWorkbench() ? await rswURL(port, kPdfJsInitialPath) + : isVSCodeServer() + ? vsCodeServerProxyUri()!.replace("{{port}}", `${port}`) + + kPdfJsInitialPath : "/" + kPdfJsInitialPath; return Promise.resolve(serveRedirect(url)); } else {