mirror of
https://github.com/friendica/friendica
synced 2024-11-14 03:42:53 +00:00
Feeds: Check the content type before fetching feeds
This commit is contained in:
parent
a54dcd2eb3
commit
c94a19375d
2 changed files with 9 additions and 2 deletions
|
@ -1715,9 +1715,11 @@ class Probe
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed = $curlResult->getBodyString();
|
$feed = $curlResult->getBodyString();
|
||||||
$feed_data = Feed::import($feed);
|
if (strpos($curlResult->getContentType(), 'xml') !== false) {
|
||||||
|
$feed_data = Feed::import($feed);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$feed_data) {
|
if (empty($feed_data)) {
|
||||||
if (!$probe) {
|
if (!$probe) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,11 @@ class OnePoll
|
||||||
return false;
|
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, '<')) {
|
if (!strstr($xml, '<')) {
|
||||||
Logger::notice('response did not contain XML.', ['id' => $contact['id'], 'url' => $contact['poll']]);
|
Logger::notice('response did not contain XML.', ['id' => $contact['id'], 'url' => $contact['poll']]);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue