talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 4f3a94b969648c6cd7703053ddcbd05fcb3d6c9a
parent 81379996cd48fdb4115189ed394d470697089dd4
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Tue, 30 Apr 2019 23:02:18 +0200

Fix parsing items with empty bodies from on-disk RSSyl items

Diffstat:
Msrc/plugins/rssyl/parse822.c | 10++++------
Msrc/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 @@ -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 @@ -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);