Skip to content

Commit

Permalink
fix: fix remote astro:assets caching logic (#8424)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmatteomanf authored Sep 6, 2023
1 parent 923a443 commit 61ad70f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/empty-rings-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes remote assets caching logic to not use expired assets
2 changes: 1 addition & 1 deletion packages/astro/src/assets/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 61ad70f

Please sign in to comment.