Don't retry when fetching invalid content

This commit is contained in:
Michael 2024-03-09 10:37:43 +00:00
parent f041701765
commit 40a47b076d
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class HttpClientAccept
public const IMAGE = 'image/webp,image/png,image/jpeg,image/gif,image/*;q=0.9,*/*;q=0.8'; // @todo add image/avif once our minimal supported PHP version is 8.1.0 public const IMAGE = 'image/webp,image/png,image/jpeg,image/gif,image/*;q=0.9,*/*;q=0.8'; // @todo add image/avif once our minimal supported PHP version is 8.1.0
public const JRD_JSON = 'application/jrd+json,application/json;q=0.9'; public const JRD_JSON = 'application/jrd+json,application/json;q=0.9';
public const JSON = 'application/json,*/*;q=0.9'; public const JSON = 'application/json,*/*;q=0.9';
public const JSON_AS = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"'; public const JSON_AS = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams",application/json;q=0.9';
public const MAGIC = 'application/magic-envelope+xml'; public const MAGIC = 'application/magic-envelope+xml';
public const MAGIC_KEY = 'application/magic-public-key'; public const MAGIC_KEY = 'application/magic-public-key';
public const RSS_XML = 'application/rss+xml,text/xml;q=0.9,*/*;q=0.8'; public const RSS_XML = 'application/rss+xml,text/xml;q=0.9,*/*;q=0.8';

View File

@ -1611,15 +1611,15 @@ class Processor
if (empty($object) || !is_array($object)) { if (empty($object) || !is_array($object)) {
Logger::notice('Invalid JSON data', ['url' => $url, 'content-type' => $curlResult->getContentType()]); Logger::notice('Invalid JSON data', ['url' => $url, 'content-type' => $curlResult->getContentType()]);
return ''; return null;
} }
if (!self::isValidObject($object, $url)) { if (!self::isValidObject($object, $url)) {
return ''; return null;
} }
if (!HTTPSignature::isValidContentType($curlResult->getContentType(), $url)) { if (!HTTPSignature::isValidContentType($curlResult->getContentType(), $url)) {
return ''; return null;
} }
$ldobject = JsonLD::compact($object); $ldobject = JsonLD::compact($object);