未验证 提交 f73e9225 编写于 作者: A Asher

Remove directory restrictions for /webview/vscode-resource

This makes viewing images work. Fixes #1111.
上级 168ccb0d
......@@ -193,6 +193,11 @@ export abstract class Server {
return { content: await util.promisify(fs.readFile)(filePath), filePath };
}
protected async getAnyResource(...parts: string[]): Promise<Response> {
const filePath = path.join(...parts);
return { content: await util.promisify(fs.readFile)(filePath), filePath };
}
protected async getTarredResource(...parts: string[]): Promise<Response> {
const filePath = this.ensureAuthorizedFilePath(...parts);
return { stream: tarFs.pack(filePath), filePath, mime: "application/tar", cache: true };
......@@ -524,7 +529,7 @@ export class MainServer extends Server {
break;
case "/webview":
if (/^\/vscode-resource/.test(requestPath)) {
return this.getResource(requestPath.replace(/^\/vscode-resource(\/file)?/, ""));
return this.getAnyResource(requestPath.replace(/^\/vscode-resource(\/file)?/, ""));
}
return this.getResource(
this.rootPath,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册