]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/Media.php
Merge pull request #11526 from annando/ap-endpoint-cache
[friendica.git] / src / Model / Post / Media.php
index ee50061cb8930b50984b643d00e696a89b941150..78f27b7a099252380b09821bc3c170d9f2dd17a3 100644 (file)
@@ -169,7 +169,7 @@ class Media
                // Fetch the mimetype or size if missing.
                if (empty($media['mimetype']) || empty($media['size'])) {
                        $timeout = DI::config()->get('system', 'xrd_timeout');
-                       $curlResult = DI::httpClient()->head($media['url'], HttpClientAccept::DEFAULT, [HttpClientOptions::TIMEOUT => $timeout]);
+                       $curlResult = DI::httpClient()->head($media['url'], [HttpClientOptions::TIMEOUT => $timeout]);
 
                        // Workaround for systems that can't handle a HEAD request
                        if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
@@ -547,12 +547,17 @@ class Media
         * @param int    $uri_id
         * @param string $guid
         * @param array  $links list of links that shouldn't be added
+        * @param bool   $has_media
         * @return array attachments
         */
-       public static function splitAttachments(int $uri_id, string $guid = '', array $links = [])
+       public static function splitAttachments(int $uri_id, string $guid = '', array $links = [], bool $has_media = true)
        {
                $attachments = ['visual' => [], 'link' => [], 'additional' => []];
 
+               if (!$has_media) {
+                       return $attachments;
+               }
+
                $media = self::getByURIId($uri_id);
                if (empty($media)) {
                        return $attachments;