Merge pull request #14411 from annando/content-type

Feeds: Check the content type before fetching feeds
This commit is contained in:
Tobias Diekershoff 2024-09-07 15:34:11 +02:00 committed by GitHub
commit 8eff24d693
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -1715,9 +1715,11 @@ class Probe
}
$feed = $curlResult->getBodyString();
if (strpos($curlResult->getContentType(), 'xml') !== false) {
$feed_data = Feed::import($feed);
}
if (!$feed_data) {
if (empty($feed_data)) {
if (!$probe) {
return [];
}

View file

@ -188,6 +188,11 @@ class OnePoll
return false;
}
if (strpos($curlResult->getContentType(), 'xml') !== false) {
Logger::notice('Unexpected content type.', ['id' => $contact['id'], 'url' => $contact['poll'], 'content-type' => $curlResult->getContentType()]);
return false;
}
if (!strstr($xml, '<')) {
Logger::notice('response did not contain XML.', ['id' => $contact['id'], 'url' => $contact['poll']]);
return false;