"excerpt" in generated JSON is always empty

  • [ ] I’m using stock docker compose setup, unmodified.
  • [ ] I’m using docker compose setup, with modifications (modified .yml files, third party plugins/themes, etc.) - if so, describe your modifications in your post. Before reporting, see if your issue can be reproduced on the unmodified setup.
  • [x] I’m not using docker on my primary instance, but my issue can be reproduced on the aforementioned docker setup and/or official demo.

I recently noticed a bug with the “generate_syndicated_feed” function that causes the “excerpt” in the generated JSON to always be empty.

Every time a generated feed is requested with “format=json” the following warning messages are written to the log. This does not affect the default “atom” format.

Undefined array key “content_preview”

  1. classes/handler/public.php(195): ttrss_error_handler(Undefined array key “content_preview”, classes/handler/public.php)
  2. classes/handler/public.php(355): generate_syndicated_feed([{“title”:“Slashdot”,“feed_url”:“https://srv.tt-rss.org/tt-rss/public.php?op=rss&id=10&key=4g2hhx6524f50b9b0c3”,“self_url”:“https://srv.tt-rss.org/tt-rss”,“articles”:[{“id”:"https://hardware.slashdot.org/story/23/10/09/2237207/vermont-utility…, , , json, , , )
  3. public.php(50): rss()

Real IP: XXX.XXX.XXX.XXX
Forwarded For: XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX
Forwarded Protocol: https
Remote IP: XXX.XXX.XXX.XXX
Request URI: /tt-rss/public.php?op=rss&id=10&is_cat=0&q=&key=4g2hhx6524f50b9b0c3&format=json
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0

  • Tiny Tiny RSS version (including git commit id): v23.10-c779e2ba0
  • Platform (i.e. Linux distro, Docker, PHP, PostgreSQL, etc) versions: N/A (official demo)

After taking a look at the code, the cause seems to be that for the atom format “content_preview” is generated based on “content” (see https://git.tt-rss.org/fox/tt-rss.git/tree/classes/handler/public.php#n93) while for “json” format the “content_preview” is created from “content_preview” which is undefined at this point (see https://git.tt-rss.org/fox/tt-rss.git/tree/classes/handler/public.php#n195).

thanks for reporting, i’ll make a note to take a look.

https://gitlab.tt-rss.org/tt-rss/tt-rss/-/commit/9556519e67773532b94b0d2fd6dad838b63e29eb

Thanks, that fixed the problem.