Fix bug where item and feed names can have unwanted characters

This commit is contained in:
Shinokuni 2019-03-10 19:59:19 +01:00
parent 18e626a303
commit 78f2b65a30
2 changed files with 5 additions and 2 deletions

View File

@ -12,6 +12,8 @@ import com.readrops.readropslibrary.localfeed.json.JSONFeed;
import com.readrops.readropslibrary.localfeed.rss.RSSChannel;
import com.readrops.readropslibrary.localfeed.rss.RSSFeed;
import org.jsoup.Jsoup;
import static android.arch.persistence.room.ForeignKey.NO_ACTION;
@Entity(foreignKeys = @ForeignKey(entity = Folder.class, parentColumns = "id", childColumns = "folder_id", onDelete = ForeignKey.SET_NULL))
@ -185,7 +187,7 @@ public class Feed implements Parcelable {
Feed feed = new Feed();
RSSChannel channel = rssFeed.getChannel();
feed.setName(channel.getTitle());
feed.setName(Jsoup.parse(channel.getTitle()).text());
feed.setUrl(channel.getFeedUrl());
feed.setSiteUrl(channel.getUrl());
feed.setDescription(channel.getDescription());

View File

@ -11,6 +11,7 @@ import com.readrops.readropslibrary.localfeed.rss.RSSItem;
import com.readrops.readropslibrary.localfeed.rss.RSSMediaContent;
import org.joda.time.LocalDateTime;
import org.jsoup.Jsoup;
import java.text.ParseException;
import java.util.ArrayList;
@ -172,7 +173,7 @@ public class Item {
newItem.setContent(item.getContent());
newItem.setDescription(item.getDescription());
newItem.setGuid(item.getGuid());
newItem.setTitle(item.getTitle());
newItem.setTitle(Jsoup.parse(item.getTitle()).text());
// I wish I hadn't done that...
if (Pattern.compile(DateUtils.RSS_ALTERNATIVE_DATE_FORMAT_REGEX).matcher(item.getDate()).matches())