diff --git a/.changeset/empty-rings-bow.md b/.changeset/empty-rings-bow.md new file mode 100644 index 000000000000..fd928d548c04 --- /dev/null +++ b/.changeset/empty-rings-bow.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes remote assets caching logic to not use expired assets diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts index b2004fad01c8..71903e9945fe 100644 --- a/packages/astro/src/assets/build/generate.ts +++ b/packages/astro/src/assets/build/generate.ts @@ -75,7 +75,7 @@ export async function generateImage( const JSONData = JSON.parse(readFileSync(cachedFileURL, 'utf-8')) as RemoteCacheEntry; // If the cache entry is not expired, use it - if (JSONData.expires < Date.now()) { + if (JSONData.expires > Date.now()) { await fs.promises.writeFile(finalFileURL, Buffer.from(JSONData.data, 'base64')); return {