From e5aa522aa8f1b4a663802d8341e2e30a937f6523 Mon Sep 17 00:00:00 2001 From: skovhus Date: Sat, 18 Apr 2020 10:16:34 +0200 Subject: [PATCH 1/2] Update glob warning message --- server/src/analyser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/analyser.ts b/server/src/analyser.ts index 5382346ed..5a56c2f92 100644 --- a/server/src/analyser.ts +++ b/server/src/analyser.ts @@ -60,7 +60,7 @@ export default class Analyzer { filePaths = await getFilePaths({ globPattern, rootPath }) } catch (error) { connection.window.showWarningMessage( - `Failed to analyze bash files using the glob "${globPattern}". The experience will be degraded. Consider configuring the glob or fix any permission issues. Error: ${error.message}`, + `Failed to analyze bash files using the glob "${globPattern}". The experience will be degraded. Error: ${error.message}`, ) } From c0ec8092e423ac8fa00c01432457135ceb3f42c9 Mon Sep 17 00:00:00 2001 From: skovhus Date: Sat, 18 Apr 2020 10:17:10 +0200 Subject: [PATCH 2/2] Run glob in non strict mode This allows directories without access to be on the given path. E.g. mkdir directory-without-access && sudo chown root:staff directory-without-access && sudo chmod 600 directory-without-access --- server/src/util/fs.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/server/src/util/fs.ts b/server/src/util/fs.ts index efdd9c150..43a114877 100644 --- a/server/src/util/fs.ts +++ b/server/src/util/fs.ts @@ -17,15 +17,16 @@ export async function getFilePaths({ rootPath: string }): Promise { return new Promise((resolve, reject) => { - glob(globPattern, { cwd: rootPath, nodir: true, absolute: true }, function( - err, - files, - ) { - if (err) { - return reject(err) - } + glob( + globPattern, + { cwd: rootPath, nodir: true, absolute: true, strict: false }, + function(err, files) { + if (err) { + return reject(err) + } - resolve(files) - }) + resolve(files) + }, + ) }) }