Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Tolerate files removed during the Postiz credential scan

vincent5ffcf21930db
diff --git a/server/postiz.e2e.test.ts b/server/postiz.e2e.test.ts
index 8248925252..d696696553 100644
--- a/server/postiz.e2e.test.ts
+++ b/server/postiz.e2e.test.ts
@@ -55,9 +55,13 @@ function filesHolding(secret: string): string[] {
const walk = (dir: string) => {
for (const name of readdirSync(dir)) {
const path = join(dir, name);
- const stat = statSync(path);
- if (stat.isDirectory()) walk(path);
- else if (stat.isFile() && stat.size < 20_000_000 && path !== fixture.fixtureDumpPath && !name.startsWith(CONFIG_BACKUP_PREFIX) && readFileSync(path).includes(secret)) found.push(relative(fixture.info.dataDir, path));
+ try {
+ const stat = statSync(path);
+ if (stat.isDirectory()) walk(path);
+ else if (stat.isFile() && stat.size < 20_000_000 && path !== fixture.fixtureDumpPath && !name.startsWith(CONFIG_BACKUP_PREFIX) && readFileSync(path).includes(secret)) found.push(relative(fixture.info.dataDir, path));
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
+ }
}
};
walk(fixture.info.dataDir);