fix: fix remote astro:assets
caching logic (#8424)
This commit is contained in:
parent
923a443cb0
commit
61ad70fdc5
2 changed files with 6 additions and 1 deletions
5
.changeset/empty-rings-bow.md
Normal file
5
.changeset/empty-rings-bow.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes remote assets caching logic to not use expired assets
|
|
@ -75,7 +75,7 @@ export async function generateImage(
|
||||||
const JSONData = JSON.parse(readFileSync(cachedFileURL, 'utf-8')) as RemoteCacheEntry;
|
const JSONData = JSON.parse(readFileSync(cachedFileURL, 'utf-8')) as RemoteCacheEntry;
|
||||||
|
|
||||||
// If the cache entry is not expired, use it
|
// 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'));
|
await fs.promises.writeFile(finalFileURL, Buffer.from(JSONData.data, 'base64'));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue