commit: f5ed5f386020a08e8a659f4a6d25d2b875852be8
parent: 2f3ac14a434c773577771b74292aa313d57db3c9
Author: unarist <m.unarist@gmail.com>
Date: Tue, 27 Mar 2018 22:18:35 +0900
Clone response before put it to the cache (#6932)
`Response.prototype.clone()` must be called before the response used.
This fixes an error from ServiceWorker and failing to load image when the
image is not cached.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/mastodon/service_worker/entry.js
@@ -56,10 +56,10 @@ self.addEventListener('fetch', function(event) {
const fetched = await fetch(event.request);
if (fetched.ok) {
- await cache.put(event.request.url, fetched);
+ await cache.put(event.request.url, fetched.clone());
}
- return fetched.clone();
+ return fetched;
}
return cached;