diff --git a/components/index.ts b/components/index.ts index 00c3d710..20477012 100644 --- a/components/index.ts +++ b/components/index.ts @@ -514,6 +514,7 @@ function startServer(options: { hmr: boolean; pluginDevHost: boolean }): void { join("userdata", "scpc", "steamids"), join("images", "actors"), join("images", "contracts"), + join("images", "contracts", "elusive"), join("images", "contracts", "escalation"), join("images", "contracts", "featured"), join("images", "unlockables_override"), diff --git a/components/menus/imageHandler.ts b/components/menus/imageHandler.ts index 7477017b..e4702d70 100644 --- a/components/menus/imageHandler.ts +++ b/components/menus/imageHandler.ts @@ -70,6 +70,14 @@ export async function imageFetchingMiddleware( if (getFlag("imageLoading") === "SAVEASREQUESTED") { log(LogLevel.DEBUG, `Saving image ${path} to disk.`) + const dir = ppath.dirname(path as Filename) + + if (!imageJailFs.existsSync(dir)) { + log(LogLevel.DEBUG, `Creating missing directory ${dir}`) + + imageJailFs.mkdirSync(dir, { recursive: true }) + } + const writeStream = imageJailFs.createWriteStream( ppath.resolve(path as Filename), )