mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
💄
This commit is contained in:
parent
7d9069baa6
commit
82e99291ce
|
@ -227,6 +227,14 @@ function getMediaMime(forPath) {
|
|||
*/
|
||||
async function serveFile(req, res, filePath, responseHeaders = Object.create(null)) {
|
||||
try {
|
||||
|
||||
// Sanity checks
|
||||
filePath = path.normalize(filePath); // ensure no "." and ".."
|
||||
if (filePath.indexOf(`${APP_ROOT}${path.sep}`) !== 0) {
|
||||
// invalid location outside of APP_ROOT
|
||||
return serveError(req, res, 400, `Bad request.`);
|
||||
}
|
||||
|
||||
const stat = await util.promisify(fs.stat)(filePath);
|
||||
|
||||
// Check if file modified since
|
||||
|
|
Loading…
Reference in a new issue