Skip to content

Commit

Permalink
fix: Renaming full page archive asset file doesn't work inside docker.
Browse files Browse the repository at this point in the history
…Fixes #273
  • Loading branch information
MohamedBassem committed Jul 5, 2024
1 parent d193d9b commit 5e9b04a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/shared/assetdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 5e9b04a

Please sign in to comment.