mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 09:03:44 +08:00
Changes RSS item creation to prevent encoding errors
SimpleRss is unreliable with parsing RSS feeds that contain German Umlauts. For example this feed http://www.lauffeuer-lb.de/api/v2/articles.xml can't be parsed by SimpleRss. Discourse's logs are full of ``` Job exception: Wrapped Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8 Job exception: incompatible character encodings: ASCII-8BIT and UTF-8 ``` The embedding fails because the feed can't be parsed. This change forces the encoding (using #scrub) which prevents the numerous encoding errors.
This commit is contained in:
parent
54b63bfdbf
commit
4ee1bc6320
|
@ -86,11 +86,15 @@ module Jobs
|
|||
end
|
||||
|
||||
def content
|
||||
@article_rss_item.content || @article_rss_item.description
|
||||
if @article_rss_item.content
|
||||
@article_rss_item.content.scrub
|
||||
else
|
||||
@article_rss_item.description.scrub
|
||||
end
|
||||
end
|
||||
|
||||
def title
|
||||
@article_rss_item.title
|
||||
@article_rss_item.title.scrub
|
||||
end
|
||||
|
||||
def user
|
||||
|
|
Loading…
Reference in New Issue
Block a user