Eliminate TOCTOU problem in creating bbTmp.

This commit is contained in:
Sam Rose 2023-11-03 14:29:54 +00:00
parent 2ffb4b96cb
commit a27a9dc2af
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -18,8 +18,12 @@ export const ObjectStoreBuckets = {
} }
const bbTmp = join(tmpdir(), ".budibase") const bbTmp = join(tmpdir(), ".budibase")
if (!fs.existsSync(bbTmp)) { try {
fs.mkdirSync(bbTmp) fs.mkdirSync(bbTmp)
} catch (e: any) {
if (e.code !== "EEXIST") {
throw e
}
} }
export function budibaseTempDir() { export function budibaseTempDir() {