Conversation
#fix FreshRSS#4702 Improvement of FreshRSS#2898
And use <figure> for enclosures
|
@Alkarex am I allowed to add my changes, that moves the HTML from |
|
I have just spotted a couple of bugs in SimplePie that needs fixing for this PR to work with various encodings |
#4943 was just the proof of concept.
ok, then it will make sense to wait till this PR is done. |
Encoding errors in enclosure links
lib/SimplePie/SimplePie/Item.php
Outdated
| } | ||
| else | ||
| { | ||
| $thumbnail['url'] = $this->sanitize($thumbnail['url'], SIMPLEPIE_CONSTRUCT_IRI); |
There was a problem hiding this comment.
The thumbnail URL was previously returned unsanitized and unescaped, as opposed to other URLs returned by SimplePie
There was a problem hiding this comment.
TODO: provide a base as parameter for absolutize_url to work. Check that other enclosure URLs are correct in this regard.
|
@math-GH Tests very much welcome already. I need to look into another SimplePie potential issue with a lack of |
SimplePie only returned the first enclosure when using the RSS 2.0 syntax for enclosures, instead of returning them all. Please merge simplepie#768 first. Downtream PR: FreshRSS/FreshRSS#4944
Add missing sanitize and absolute_url on thumbnail URL. SimplePie normally sanitizes all URLs, but the thumbnail URL was not processed. Related to simplepie#768 Downstream PR FreshRSS/FreshRSS#4944
|
This PR breaks the multi enclosures of Atom feeds. Example feed: https://github.com/math-GH/testfeed/blob/main/Atomfeed-with-enclosure.xml
|
@math-GH This is because the HTML content already contains those images, in order to avoid duplicates (cf. #1668 ) The four enclosures are correctly stored in database and provided again e.g. via API or RSS view {
"enclosures": [{
"url": "https://0.gravatar.com/avatar/347dfeae267d8d9b7c8bf959b3b97baa?s=96&d=identicon&r=G",
"title": "tomsgedankenblog",
"medium": "image"
}, {
"url": "https://agileverwaltungorg.files.wordpress.com/2022/10/grafik-4.png?w=605",
"medium": "image"
}, {
"url": "https://agileverwaltungorg.files.wordpress.com/2022/10/grafik-3.png?w=605",
"medium": "image"
}, {
"url": "https://agileverwaltungorg.files.wordpress.com/2022/10/grafik-5.png?w=605",
"medium": "image"
}
]
} |
Avoid generating all enclosures if not used
Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite)
|
@Alkarex That is a great improvement ❤️ |
|
Let's give it a try 🚀 |
I do not know if it is a bug or improvement or a feature: |
@math-GH Compared to before, the sole difference should be that we now support the dedicated |
* No URL Decode for enclosure links This line was introduced in 8a5f601#diff-a710c236cc7775672edbe5840d8fb96b0e91b0d56eff709f6eace2da47c1fe43R349-R359 Seems to be a similar error than efb1d8e Having an `urldecode` returns some potentially invalid URLs, while SimplePie does not do that for other returned URLs Downstream PR FreshRSS/FreshRSS#4944 P.S. There are a few other bugs related to enclosure links, and I will try to address some of them in distinct PRs. * Add tests * Simplify tests * Whitespace * PHP 7.2 compat * Update tests/Unit/EnclosureTest.php Co-authored-by: Jan Tojnar <jtojnar@gmail.com> Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
* Sanitize thumbnail URL Add missing sanitize and absolute_url on thumbnail URL. SimplePie normally sanitizes all URLs, but the thumbnail URL was not processed. Related to #768 Downstream PR FreshRSS/FreshRSS#4944 * Update tests syntax
* No URL Decode for enclosure links This line was introduced in 8a5f601#diff-a710c236cc7775672edbe5840d8fb96b0e91b0d56eff709f6eace2da47c1fe43R349-R359 Seems to be a similar error than efb1d8e Having an `urldecode` returns some potentially invalid URLs, while SimplePie does not do that for other returned URLs Downstream PR FreshRSS/FreshRSS#4944 P.S. There are a few other bugs related to enclosure links, and I will try to address some of them in distinct PRs. * Add tests * Simplify tests * Fix case of multiple RSS2.0 enclosures SimplePie only returned the first enclosure when using the RSS 2.0 syntax for enclosures, instead of returning them all. Please merge #768 first. Downtream PR: FreshRSS/FreshRSS#4944 * Whitespace * PHP 7.2 compat * PHP 7.2 compat * Update tests/Unit/EnclosureTest.php Co-authored-by: Artur Weigandt <Art4@users.noreply.github.com> * Update tests/Unit/EnclosureTest.php Co-authored-by: Jan Tojnar <jtojnar@gmail.com> * Update src/Item.php Co-authored-by: Jan Tojnar <jtojnar@gmail.com> * Update tests syntax Co-authored-by: Artur Weigandt <Art4@users.noreply.github.com> Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
* Better enclosures #fix FreshRSS#4702 Improvement of FreshRSS#2898 * A few fixes * Better enclosure titles * Improve thumbnails * Implement thumbnail for HTML+XPath * Avoid duplicate enclosures #fix FreshRSS#1668 * Fix regex * Add basic support for media:credit And use <figure> for enclosures * Fix link encoding + simplify code * Fix some SimplePie bugs Encoding errors in enclosure links * Remove debugging syslog * Remove debugging syslog * SimplePie fix multiple RSS2 enclosures #fix FreshRSS#4974 * Improve thumbnails * Performance with yield Avoid generating all enclosures if not used * API keep providing enclosures inside content Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite) * Lint * Fix API output enclosure * Fix API content strcut * API tolerate enclosures without a type
#fix #4702
Improvement of #2898