@@ -266,7 +266,7 @@ function validateUriIsCanonical(uri: vscode.Uri): void {
266266 * allowed in web app workspace folders. This filtering is done here to
267267 * avoid spamming the server with requests that will never return meaningful data.
268268 */
269- function filterDotPaths ( uri : vscode . Uri , error ?: vscode . FileSystemError ) : void {
269+ function assertDotPathValid ( uri : vscode . Uri , error ?: vscode . FileSystemError ) : void {
270270 if ( ! isfsConfig ( uri ) . csp && uri . path . includes ( "/." ) && ! / \/ \. v s c o d e ( $ | \/ ) / . test ( uri . path ) ) {
271271 throw error ?? vscode . FileSystemError . FileNotFound ( uri ) ;
272272 }
@@ -312,7 +312,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
312312 public async stat ( uri : vscode . Uri ) : Promise < vscode . FileStat > {
313313 const api = new AtelierAPI ( uri ) ;
314314 if ( ! api . active ) throw vscode . FileSystemError . Unavailable ( "Server connection is inactive" ) ;
315- filterDotPaths ( uri ) ;
315+ assertDotPathValid ( uri ) ;
316316 validateUriIsCanonical ( uri ) ;
317317 let entryPromise : Promise < Entry > ;
318318 let result : Entry ;
@@ -363,7 +363,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
363363 }
364364
365365 public async readDirectory ( uri : vscode . Uri ) : Promise < [ string , vscode . FileType ] [ ] > {
366- filterDotPaths ( uri ) ;
366+ assertDotPathValid ( uri ) ;
367367 if ( uri . path . includes ( ".vscode/" ) || uri . path . endsWith ( ".vscode" ) ) {
368368 throw new vscode . FileSystemError ( "Cannot read the /.vscode directory" ) ;
369369 }
@@ -480,7 +480,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
480480 }
481481
482482 public createDirectory ( uri : vscode . Uri ) : void | Thenable < void > {
483- filterDotPaths ( uri , new vscode . FileSystemError ( "dot-folders are not supported by the server" ) ) ;
483+ assertDotPathValid ( uri , new vscode . FileSystemError ( "dot-folders are not supported by the server" ) ) ;
484484 uri = redirectDotvscodeRoot ( uri , new vscode . FileSystemError ( "Server does not have a /_vscode web application" ) ) ;
485485 const basename = path . posix . basename ( uri . path ) ;
486486 const dirname = uri . with ( { path : path . posix . dirname ( uri . path ) } ) ;
@@ -497,7 +497,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
497497 }
498498
499499 public async readFile ( uri : vscode . Uri ) : Promise < Uint8Array > {
500- filterDotPaths ( uri ) ;
500+ assertDotPathValid ( uri ) ;
501501 validateUriIsCanonical ( uri ) ;
502502 // Use _lookup() instead of _lookupAsFile() so we send
503503 // our cached mtime with the GET /doc request if we have it
@@ -512,7 +512,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
512512 overwrite : boolean ;
513513 }
514514 ) : void | Thenable < void > {
515- filterDotPaths ( uri , new vscode . FileSystemError ( "dot-folders are not supported by the server" ) ) ;
515+ assertDotPathValid ( uri , new vscode . FileSystemError ( "dot-folders are not supported by the server" ) ) ;
516516 const originalUriString = uri . toString ( ) ;
517517 const originalUri = vscode . Uri . parse ( originalUriString ) ;
518518 this . _needsUpdate . delete ( originalUriString ) ;
@@ -712,7 +712,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
712712 }
713713
714714 public async delete ( uri : vscode . Uri , options : { recursive : boolean } ) : Promise < void > {
715- filterDotPaths ( uri ) ;
715+ assertDotPathValid ( uri ) ;
716716 uri = redirectDotvscodeRoot ( uri , vscode . FileSystemError . FileNotFound ( uri ) ) ;
717717 validateUriIsCanonical ( uri ) ;
718718 const { project } = isfsConfig ( uri ) ;
0 commit comments