Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[astro-rss] @astrojs/rss from 1.1.0 encode HTML in tags (instead of usage CDATA) and remove CDATA from customData #5677

Closed
1 task
le0pard opened this issue Dec 27, 2022 · 7 comments
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: rss Related to the `@astrojs/rss` package (scope)

Comments

@le0pard
Copy link

le0pard commented Dec 27, 2022

What version of astro are you using?

1.7.2

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

Problem reproduced on @astrojs/rss >= 1.1.0.

  1. @astrojs/rss till version 1.1.0 use CDATA to safely define any content in description tag. But started from 1.1.0 it just using encode all tags, if they present in XML tags. This lead, that in rss content was readable as valid HTML with CDATA, now it just show in some RSS readers as encoded HTML content. Added screenshots
    Screenshot 2022-12-27 at 14 39 33
    Screenshot 2022-12-27 at 14 40 14

  2. Any tags inside customData with CDATA converted to encoded data without CDATA inside. Example:

`<itunes:subtitle><![CDATA[${_truncate(post.frontmatter.htmlAsText(), { length: 150, omission: '...' })}]]></itunes:subtitle>`,
`<itunes:summary><![CDATA[${post.frontmatter.htmlAsText()}]]></itunes:summary>`,
`<itunes:duration>${post.frontmatter.duration}</itunes:duration>`,

Converted to result on screenshot

Screenshot 2022-12-27 at 14 43 12

Current solution is to use 1.0.3 and do not upgrade @astrojs/rss.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-jgvjth?file=src/pages/rss.xml.js

Participation

  • I am willing to submit a pull request for this issue.
@le0pard le0pard changed the title @astrojs/rss from 1.1.0 encode HTML in tags (instead of usage CDATA) and remove CDATA from customData [astro-rss] @astrojs/rss from 1.1.0 encode HTML in tags (instead of usage CDATA) and remove CDATA from customData Dec 27, 2022
@matthewp
Copy link
Contributor

matthewp commented Feb 8, 2023

Is this still an issue in 2.x?

@matthewp matthewp added the needs response Issue needs response from OP label Feb 8, 2023
@le0pard
Copy link
Author

le0pard commented Feb 8, 2023

@matthewp yes, it is. Tested @astrojs/rss version 2.1.0

No CDATA, just escaped all tags
Screenshot 2023-02-08 at 21 42 35

@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) - P4: important Violate documented behavior or significantly impacts performance (priority) and removed needs response Issue needs response from OP - P3: minor bug An edge case that only affects very specific usage (priority) labels Mar 23, 2023
@ematipico
Copy link
Member

Will look into it

@natemoo-re natemoo-re added the pkg: rss Related to the `@astrojs/rss` package (scope) label Aug 10, 2023
@lilnasy
Copy link
Contributor

lilnasy commented Dec 4, 2023

This seems to be intentionally disallowed by #5550.

Is there a way to add the custom data you want without undoing protections introduced by that PR?

@le0pard
Copy link
Author

le0pard commented Dec 4, 2023

Yep, will be cool, if will be option to escape only ]]> (need split on 2 CDATA), if it happen in content instead all html tags. But I figured myself how to fight with this (form xml myself). So I will close for now.

@le0pard le0pard closed this as completed Dec 4, 2023
@JaneSmith
Copy link

This seems to still be an issue with 4.0.7. Can you clarify what your workaround was exactly?

@le0pard
Copy link
Author

le0pard commented Oct 6, 2024

@JaneSmith as I wrote previously - I am stop using "@astrojs/rss" and just form rss myself

// src/pages/rss.xml.js
export const GET = async () => {
  const result = generateRssToString()

  return new Response(result, {
    headers: {
      'Content-Type': 'application/xml'
    }
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: rss Related to the `@astrojs/rss` package (scope)
Projects
None yet
Development

No branches or pull requests

7 participants