Skip to content

Commit

Permalink
reorder if block
Browse files Browse the repository at this point in the history
  • Loading branch information
sharon-wang committed Dec 23, 2024
1 parent 87ae243 commit c163acf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions extensions/positron-proxy/src/htmlProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export class HtmlProxyServer implements Disposable {
}

// Create a new path entry.
if (vscode.env.uiKind === vscode.UIKind.Web) {
if (vscode.env.uiKind !== vscode.UIKind.Web) {
this._app.use(`/${serverPath}`, express.static(targetPath));
} else {
// If we're running in the web, we need to inject resources for the preview HTML.
this._app.use(`/${serverPath}`, async (req, res, next) => {
const filePath = path.join(targetPath, req.path);
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
Expand All @@ -100,8 +103,6 @@ export class HtmlProxyServer implements Disposable {
next();
}
});
} else {
this._app.use(`/${serverPath}`, express.static(targetPath));
}
const address = this._server.address();
if (!isAddressInfo(address)) {
Expand Down

0 comments on commit c163acf

Please sign in to comment.