From f18b48457aee0c6e8b12134494280aece2f08b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 7 May 2024 15:03:09 +0200 Subject: [PATCH] fix: prevent infinite loop on readdir --- src/service-override/files.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/service-override/files.ts b/src/service-override/files.ts index ea065c02..40206011 100644 --- a/src/service-override/files.ts +++ b/src/service-override/files.ts @@ -194,8 +194,9 @@ class RegisteredFileSystemProvider extends Disposable implements IFileSystemProv public async readdir (resource: URI): Promise<[string, FileType][]> { const includedPaths = Array.from(this.files.keys()) - .map(uri => extUri.relativePath(resource, URI.parse(uri))!) - .filter(path => !path.startsWith('..')) + .map(uri => URI.parse(uri)) + .filter(uri => uri.path.startsWith(resource.path)) + .map(uri => extUri.relativePath(resource, uri)!) const files = includedPaths.filter(path => !path.includes('/')) const directories = includedPaths.filter(path => path.includes('/')).map(path => path.slice(0, path.indexOf('/')))