]> cat aescling's git repositories - mastodon.git/commitdiff
Clone response before using when caching web page (#7498)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Tue, 15 May 2018 12:24:50 +0000 (21:24 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 15 May 2018 12:24:50 +0000 (14:24 +0200)
app/javascript/mastodon/service_worker/entry.js

index 5ad03caf2c637da9883c2ddd9af8232a610ed439..9a3911b2a80846bfe2915242b27b476808634e28 100644 (file)
@@ -30,8 +30,8 @@ self.addEventListener('fetch', function(event) {
 
     event.respondWith(asyncResponse.then(response => {
       if (response.ok) {
-        return asyncCache.then(cache => cache.put('/', response))
-                         .then(() => response.clone());
+        return asyncCache.then(cache => cache.put('/', response.clone()))
+                         .then(() => response);
       }
 
       throw null;