Jelajahi Sumber

Fix SimplePie autodiscovery for text/xml HTML pages

https://github.com/FreshRSS/FreshRSS/issues/1264
Alexandre Alapetite 9 tahun lalu
induk
melakukan
a37484fd2f
2 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 2 0
      CHANGELOG.md
  2. 4 4
      lib/SimplePie/SimplePie/Content/Type/Sniffer.php

+ 2 - 0
CHANGELOG.md

@@ -12,6 +12,8 @@
 	* Support custom ports `localhost:3306` for database servers [#1241](https://github.com/FreshRSS/FreshRSS/issues/1241)
 * Bug fixing
 	* Correction of bugs related CSRF tokens introduced in version 1.5.0 [#1253](https://github.com/FreshRSS/FreshRSS/issues/1253), [44f22ab](https://github.com/FreshRSS/FreshRSS/pull/1261/commits/d9bf9b2c6f0b2cc9dec3b638841b7e3040dcf46f)
+* SimplePie
+	* Fix auto-discovery of RSS feeds in Web pages served as `text/xml` [#1264](https://github.com/FreshRSS/FreshRSS/issues/1264)
 * Security
 	* Prevent `<a target="_blank">` attacks with `window.opener` [#1245](https://github.com/FreshRSS/FreshRSS/issues/1245)
 * UI

+ 4 - 4
lib/SimplePie/SimplePie/Content/Type/Sniffer.php

@@ -109,9 +109,7 @@ class SimplePie_Content_Type_Sniffer
 			{
 				return $this->unknown();
 			}
-			elseif (substr($official, -4) === '+xml'
-				|| $official === 'text/xml'
-				|| $official === 'application/xml')
+			elseif (substr($official, -4) === '+xml')
 			{
 				return $official;
 			}
@@ -126,7 +124,9 @@ class SimplePie_Content_Type_Sniffer
 					return $official;
 				}
 			}
-			elseif ($official === 'text/html')
+			elseif ($official === 'text/html'
+				|| $official === 'text/xml'
+				|| $official === 'application/xml')
 			{
 				return $this->feed_or_html();
 			}