Merge pull request #12274 from Budibase/ensure-bbtmp-exists

Eliminate TOCTOU problem in creating bbTmp.
This commit is contained in:
Sam Rose 2023-11-03 16:00:27 +00:00 committed by GitHub
commit 38d7dfda92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

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