Add missing encoding of `$family` in font download requests
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 10:46:01 +0000 (12:46 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 10:46:01 +0000 (12:46 +0200)
wcfsetup/install/files/lib/system/style/FontManager.class.php

index d55120ef4290fea28bd131cf1dd9d1c8b64c1030..92e57e07919b3cc887156e03ad7229d7c55872d1 100644 (file)
@@ -74,7 +74,7 @@ class FontManager extends SingletonFactory {
         */
        public function downloadFamily($family) {
                try {
-                       $response = $this->http->send(new Request('GET', $family.'/manifest.json'));
+                       $response = $this->http->send(new Request('GET', \rawurlencode($family) . '/manifest.json'));
                        $manifest = JSON::decode($response->getBody());
                        
                        $familyDirectory = dirname($this->getCssFilename($family));
@@ -87,7 +87,7 @@ 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', \rawurlencode($family) . '/' . \rawurlencode($filename)), [
                                        // https://github.com/guzzle/guzzle/issues/2735
                                        'sink' => \GuzzleHttp\Psr7\stream_for(fopen("php://temp", "w+")),
                                ]);