Simplify valid path check

This commit is contained in:
Asher 2020-08-05 12:45:50 -05:00
parent fd36f8c168
commit 543d64268d
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -39,7 +39,7 @@ export class StaticHttpProvider extends HttpProvider {
// Make sure it's in code-server or a plugin.
const validPaths = [this.rootPath, process.env.PLUGIN_DIR]
if (!validPaths.find((p) => typeof p !== "undefined" && p.length > 0 && resourcePath.startsWith(p))) {
if (!validPaths.find((p) => p && resourcePath.startsWith(p))) {
this.ensureAuthenticated(request)
}