Skip to content

Commit

Permalink
Use getOutDirWithinCwd in the serverRoot declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
MichailiK committed Sep 26, 2023
1 parent 2d8d2e0 commit c4b5e71
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/astro/src/assets/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function generateImage(
serverRoot = config.build.server;
clientRoot = config.build.client;
} else {
serverRoot = config.outDir;
serverRoot = getOutDirWithinCwd(config.outDir);
clientRoot = config.outDir;
}

Expand Down Expand Up @@ -104,13 +104,9 @@ export async function generateImage(

// If the image is local, we can just read it directly, otherwise we need to download it
if (isLocalImage) {
const outDir = isServerLikeOutput(config)
? config.build.server
: getOutDirWithinCwd(config.outDir);

imageData = await fs.promises.readFile(
new URL(
prependForwardSlash(join(outDir.pathname + config.build.assets, basename(originalImagePath))),
'.' + prependForwardSlash(join(config.build.assets, basename(originalImagePath))),
serverRoot
)
);
Expand Down

0 comments on commit c4b5e71

Please sign in to comment.