]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Proxy.php
Merge pull request #10627 from annando/like-announce
[friendica.git] / src / Module / Proxy.php
index 6ccc38f60d7000829bafe7307378aeb72eb485f7..04fe00db1248a8ed07e726c525b256f9b75986a7 100644 (file)
@@ -40,10 +40,7 @@ class Proxy extends BaseModule
 {
 
        /**
-        * Initializer method for this class.
-        *
-        * Sets application instance and checks if /proxy/ path is writable.
-        *
+        * Fetch remote image content
         */
        public static function rawContent(array $parameters = [])
        {
@@ -78,11 +75,10 @@ class Proxy extends BaseModule
                $request['url'] = str_replace(' ', '+', $request['url']);
 
                // Fetch the content with the local user
-               $fetchResult = HTTPSignature::fetchRaw($request['url'], local_user(), ['timeout' => 10]);
+               $fetchResult = HTTPSignature::fetchRaw($request['url'], local_user(), ['accept_content' => '', 'timeout' => 10]);
                $img_str = $fetchResult->getBody();
 
-               // If there is an error then return an error
-               if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || empty($img_str)) {
+               if (!$fetchResult->isSuccess() || empty($img_str)) {
                        Logger::info('Error fetching image', ['image' => $request['url'], 'return' => $fetchResult->getReturnCode(), 'empty' => empty($img_str)]);
                        self::responseError();
                        // stop.