Skip to content

Commit 2409063

Browse files
Oxyjunns476
andauthored
Apply suggestions from code review
Co-authored-by: Nicholas Skehin <[email protected]>
1 parent 2f3121b commit 2409063

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content/docs/images/examples/watermark-from-kv.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export default {
1919
const watermarkKey = "my-watermark";
2020
const sourceKey = "my-source-image";
2121

22-
let cache = await caches.open("transformed-images");
23-
let cacheKey = watermarkKey + "/" + sourceKey;
24-
let cacheResponse = await cache.match(watermarkKey + "/" + sourceKey);
22+
const cache = await caches.open("transformed-images");
23+
const cacheKey = new URL(sourceKey + "/" + watermarkKey, request.url);
24+
const cacheResponse = await cache.match(cacheKey);
2525

2626
if (cacheResponse) {
2727
return cacheResponse;
@@ -40,7 +40,7 @@ export default {
4040

4141
const response = result.response();
4242

43-
ctx.waitUntil(cache.put(cacheKey, response));
43+
ctx.waitUntil(cache.put(cacheKey, response.clone()));
4444

4545
return result.response();
4646
},

0 commit comments

Comments
 (0)