Repository navigation
[Webhook] Keep the HTML of the {content} placeholder intact - #562
Merged
Merged
Conversation
The `{content}` placeholder is documented as the article content in HTML
format, but it was passed through `htmlspecialchars_decode()` like the
plain-text placeholders. `FreshRSS_Entry::content()` already returns
HTML, so decoding it turned escaped text into markup: an article about
the `<b>` tag produced an unclosed `<b>` element, escaped code
samples such as `<script>` became live tags, `&` became a bare
`&`, and `"` could end a double-quoted attribute early.
Insert the content as is. The plain-text placeholders (`{title}`,
`{author}`, `{url}`, ...) are still decoded, which is correct for them.
Also fix the README, which documented `{date}`, `{date_timestamp}` and
`{thumbnail_url}` placeholders that have never existed in the extension
and are sent literally. Document `{date_published}`, `{date_received}`,
`{date_modified}` and `{date_user_modified}` instead, like the
configuration page does, and use them in the examples.
Bump the extension version to 0.2.6.
Fixes FreshRSS#560
Member
|
Hum, I am not sure this is a good idea. I do not see it as good practice to have HTML-encoded content in JSON, where plain HTML is possible. |
Contributor
Author
|
The payload still carries plain HTML (real |
Member
|
You are right. Sorry, I had read a bit too fast |
Alkarex
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{content}as is in custom webhook bodies, without runninghtmlspecialchars_decode()on it:FreshRSS_Entry::content()is already HTML, so decoding turned escaped text into markup (an unclosed<b>from<b>, live<script>tags from escaped code samples, bare&, broken double-quoted attributes){title},{author},{url},{feed_name}, …) keep being decoded, which is correct for them{date},{date_timestamp}and{thumbnail_url}placeholders, which never existed and were sent literally, with the actual{date_published},{date_received},{date_modified}and{date_user_modified}(as listed on the configuration page), and update the examplesFixes #560
Validation
End to end, with FreshRSS
edgethrough its CLI (do-install,import-for-user,actualize-user), a local feed, and a local endpoint that records the requests it receives. The webhook body is{"title": "{title}", "content": "{content}"}, and the feed item has the description<p>Use the <b> tag & <a href="…" title="say "hi"">this link</a></p>.Before:
{"title":"Tom & Jerry","content":"<p>Use the <b> tag & <a href=\"http://127.0.0.1:8081/x\" title='say \"hi\"'>this link</a></p>"}After:
{"title":"Tom & Jerry","content":"<p>Use the <b> tag & <a href=\"http://127.0.0.1:8081/x\" title='say \"hi\"'>this link</a></p>"}Also ran
composer run-script php-lint,phtml-lint,phpcs,test-image-proxyandphpstan(with../FreshRSS), plusmarkdownlint-cli2on the README.