Archived
1
0

Fix webview resource path

This commit is contained in:
Asher 2020-10-27 17:17:05 -05:00
parent 257d9a4fa4
commit 6422a8d74b
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -90,8 +90,8 @@ router.get("/vscode-remote-resource(/*)?", async (req, res) => {
router.get("/webview/*", async (req, res) => { router.get("/webview/*", async (req, res) => {
ensureAuthenticated(req) ensureAuthenticated(req)
res.set("Content-Type", getMediaMime(req.path)) res.set("Content-Type", getMediaMime(req.path))
if (/^\/vscode-resource/.test(req.path)) { if (/^vscode-resource/.test(req.params[0])) {
return res.send(await fs.readFile(req.path.replace(/^\/vscode-resource(\/file)?/, ""))) return res.send(await fs.readFile(req.params[0].replace(/^vscode-resource(\/file)?/, "")))
} }
return res.send( return res.send(
await fs.readFile(path.join(vscode.vsRootPath, "out/vs/workbench/contrib/webview/browser/pre", req.params[0])), await fs.readFile(path.join(vscode.vsRootPath, "out/vs/workbench/contrib/webview/browser/pre", req.params[0])),