Fix truncated FontManager downloads on Windows
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Jul 2020 11:47:50 +0000 (13:47 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Jul 2020 11:47:50 +0000 (13:47 +0200)
wcfsetup/install/files/lib/system/style/FontManager.class.php

index 0e2907876d76941ec6826dd9a9a33eb98e6c0951..c9ba1d4a9d10fb6e908e5ff0cd61c112d1da4a91 100644 (file)
@@ -86,11 +86,14 @@ class FontManager extends SingletonFactory {
                                        throw new \InvalidArgumentException("Invalid filename '".$filename."' given.");
                                }
                                
-                               $response = $this->http->send(new Request('GET', $family.'/'.$filename));
+                               $response = $this->http->send(new Request('GET', $family.'/'.$filename), [
+                                       // https://github.com/guzzle/guzzle/issues/2735
+                                       'sink' => fopen("php://temp", "w+"),
+                               ]);
                                
                                $file = new AtomicWriter($familyDirectory.'/'.$filename);
                                while (!$response->getBody()->eof()) {
-                                       $file->write($response->getBody()->read(4096));
+                                       $file->write($response->getBody()->read(8192));
                                }
                                $response->getBody()->close();
                                $file->flush();