From 5e9b04a6e390528451246e6fdae874ffb2451231 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 5 Jul 2024 23:41:22 +0000 Subject: [PATCH] fix: Renaming full page archive asset file doesn't work inside docker. Fixes #273 --- packages/shared/assetdb.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/shared/assetdb.ts b/packages/shared/assetdb.ts index 3444001a..dd464139 100644 --- a/packages/shared/assetdb.ts +++ b/packages/shared/assetdb.ts @@ -89,12 +89,15 @@ export async function saveAssetFromFile({ await fs.promises.mkdir(assetDir, { recursive: true }); await Promise.all([ - fs.promises.rename(assetPath, path.join(assetDir, "asset.bin")), + // We'll have to copy first then delete the original file as inside the docker container + // we can't move file between mounts. + fs.promises.copyFile(assetPath, path.join(assetDir, "asset.bin")), fs.promises.writeFile( path.join(assetDir, "metadata.json"), JSON.stringify(metadata), ), ]); + await fs.promises.rm(assetPath); } export async function readAsset({