aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Models/Feed.php10
-rw-r--r--lib/SimplePie/SimplePie.php12
2 files changed, 15 insertions, 7 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index baaf448f8..f43237b00 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -352,9 +352,15 @@ class FreshRSS_Feed extends Minz_Model {
}
$links = $simplePie->get_links('self');
- $this->selfUrl = $links[0] ?? '';
+ $this->selfUrl = empty($links[0]) ? '' : checkUrl($links[0]);
+ if ($this->selfUrl == false) {
+ $this->selfUrl = '';
+ }
$links = $simplePie->get_links('hub');
- $this->hubUrl = $links[0] ?? '';
+ $this->hubUrl = empty($links[0]) ? '' : checkUrl($links[0]);
+ if ($this->hubUrl == false) {
+ $this->hubUrl = '';
+ }
if ($loadDetails) {
// si on a utilisé l’auto-discover, notre url va avoir changé
diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php
index bf4a66bb4..60edf5274 100644
--- a/lib/SimplePie/SimplePie.php
+++ b/lib/SimplePie/SimplePie.php
@@ -2726,12 +2726,14 @@ class SimplePie
if (isset($this->data['headers']['link']))
{
$link_headers = $this->data['headers']['link'];
- if (is_string($link_headers)) {
- $link_headers = array($link_headers);
+ if (is_array($link_headers)) {
+ $link_headers = implode(',', $link_headers);
}
- $matches = preg_filter('/<([^>]+)>; rel='.preg_quote($rel).'/', '$1', $link_headers);
- if (!empty($matches)) {
- return $matches;
+ // https://datatracker.ietf.org/doc/html/rfc8288
+ if (is_string($link_headers) &&
+ preg_match_all('/<(?P<uri>[^>]+)>\s*;\s*rel\s*=\s*(?P<quote>"?)' . preg_quote($rel) . '(?P=quote)\s*(?=,|$)/i', $link_headers, $matches))
+ {
+ return $matches['uri'];
}
}