recursive mkdir for uploads directory

This commit is contained in:
hippoz 2023-08-08 21:32:27 +03:00
parent add3197d65
commit deb57d26cc
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED

View file

@ -41,7 +41,7 @@ export const attachmentUploadDirectory = path.resolve(process.env.ATTACHMENT_UPL
const ensureDirectory = (dir: string) => {
const stats = statSync(dir, { throwIfNoEntry: false });
if (!stats) {
mkdirSync(dir, { mode: uploadsDirectoryMode });
mkdirSync(dir, { mode: uploadsDirectoryMode, recursive: true });
return;
}
if (!stats.isDirectory()) {