From d405b9c5472922f089c200eae12d27911950f358 Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Tue, 30 Apr 2019 23:02:18 +0200 Subject: [PATCH] Fix parsing items with empty bodies from on-disk RSSyl items --- src/plugins/rssyl/parse822.c | 10 ++++------ src/plugins/rssyl/rssyl_add_item.c | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c index 1c89c77c9..51cb313e8 100644 --- a/src/plugins/rssyl/parse822.c +++ b/src/plugins/rssyl/parse822.c @@ -198,6 +198,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) if( !strcmp(lines[i], RSSYL_TEXT_START) ) { debug_print("RSSyl: Leading html tag found at line %d\n", i); past_html_tag = TRUE; + body = g_string_new(""); i++; continue; } @@ -208,12 +209,9 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) continue; } - if (body) { + if (body->len > 0) body = g_string_append_c(body, '\n'); - body = g_string_append(body, lines[i]); - } else { - body = g_string_new(lines[i]); - } + body = g_string_append(body, lines[i]); i++; } @@ -224,7 +222,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) } if (body != NULL ) { - if (past_endhtml_tag && body->str != NULL && body->len > 0) + if (past_html_tag && past_endhtml_tag && body->str != NULL) feed_item_set_text(item, body->str); g_string_free(body, TRUE); } diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c index d22e1dd62..c40c9cd60 100644 --- a/src/plugins/rssyl/rssyl_add_item.c +++ b/src/plugins/rssyl/rssyl_add_item.c @@ -542,7 +542,8 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) (heading ? heading : ""), (tmpurl ? tmpurl : ""), (tmpurl ? tmpurl : "n/a"), - (text ? text : ""), (text ? "\n" : "") ); + (text ? text : ""), + (text && strlen(text) > 0 ? "\n" : "") ); g_free(meta_charset); g_free(baseurl); -- 2.25.1