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

Remove invalid XML characters from RSS feeds #4416

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

Elara6331
Copy link
Contributor

This PR removes any invalid XML characters from RSS strings based on the XML grammar definition for Char, which is located here: https://www.w3.org/TR/xml/#NT-Char.

I've tested this, and xmllint successfully parses the text from the post referenced in #4382 after it's sanitized by the sanitize_xml() function.

Fixes #4382

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thx.

@Elara6331 Elara6331 changed the title Remove all characters that are disallowed by XML Remove invalid XML characters from RSS feeds Jan 30, 2024
@Nutomic
Copy link
Member

Nutomic commented Jan 30, 2024

Is it correct to remove these characters or should they better be escaped/replaced?

@Elara6331
Copy link
Contributor Author

There's no way to represent these characters in valid XML, and they're not printable, so removing them won't affect any actual content. The post that broke the RSS reader in #4382 only contained them because it contained raw Java bytecode.

@Nutomic Nutomic merged commit 328d48e into LemmyNet:main Jan 30, 2024
1 check passed
@Elara6331 Elara6331 deleted the sanitize-xml branch January 30, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Posts with unescaped symbols cause RSS to break
3 participants