Merge pull request #5585 from ByteHamster/favorites-export

Fix favorites export when item does not have website
This commit is contained in:
ByteHamster 2021-12-10 21:14:28 +01:00 committed by GitHub
commit add003c06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -117,10 +117,17 @@ public class FavoritesWriter implements ExportWriter {
} }
private void writeFavoriteItem(Writer writer, FeedItem item, String favoriteTemplate) throws IOException { private void writeFavoriteItem(Writer writer, FeedItem item, String favoriteTemplate) throws IOException {
String favItem = favoriteTemplate String favItem = favoriteTemplate.replace("{FAV_TITLE}", item.getTitle().trim());
.replace("{FAV_TITLE}", item.getTitle().trim()) if (item.getLink() != null) {
.replace("{FAV_WEBSITE}", item.getLink()) favItem = favItem.replace("{FAV_WEBSITE}", item.getLink());
.replace("{FAV_MEDIA}", item.getMedia().getDownload_url()); } else {
favItem = favItem.replace("{FAV_WEBSITE}", "");
}
if (item.getMedia() != null && item.getMedia().getDownload_url() != null) {
favItem = favItem.replace("{FAV_MEDIA}", item.getMedia().getDownload_url());
} else {
favItem = favItem.replace("{FAV_MEDIA}", "");
}
writer.append(favItem); writer.append(favItem);
} }