From 584c14eb5dd080bb1c0435f48b67e10e88e34a77 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 3 Jan 2015 21:45:02 +0100 Subject: clear some fields if they are set previously (some feeds define multiple date field) --- sfeed.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sfeed.c b/sfeed.c index efe67e1..9b343bb 100644 --- a/sfeed.c +++ b/sfeed.c @@ -505,7 +505,6 @@ xml_handler_attr(XMLParser *p, const char *tag, size_t taglen, } if(ctx.item.feedtype == FeedTypeAtom) { - /*if(ctx.tagid == AtomTagContent || ctx.tagid == AtomTagSummary) {*/ if(ISCONTENTTAG(ctx)) { if(isattr(name, namelen, STRP("type")) && (isattr(value, valuelen, STRP("xhtml")) || @@ -591,11 +590,15 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) if(!(ctx.tagid == RSSTagDescription && ctx.item.content.len)) { ctx.iscontenttag = 1; ctx.field = &ctx.item.content; + return; } } else if(ctx.tagid == RSSTagGuid) ctx.field = &ctx.item.id; else if(ctx.tagid == RSSTagAuthor || ctx.tagid == RSSTagDccreator) ctx.field = &ctx.item.author; + /* clear field */ + if(ctx.field) + string_clear(ctx.field); } else if(ctx.item.feedtype == FeedTypeAtom) { if(ctx.tagid == AtomTagPublished || ctx.tagid == AtomTagUpdated) ctx.field = &ctx.item.timestamp; @@ -609,6 +612,7 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) if(!(ctx.tagid == AtomTagSummary && ctx.item.content.len)) { ctx.iscontenttag = 1; ctx.field = &ctx.item.content; + return; } } else if(ctx.tagid == AtomTagId) ctx.field = &ctx.item.id; @@ -616,6 +620,9 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) ctx.field = &ctx.item.link; else if(ctx.tagid == AtomTagAuthor) ctx.field = &ctx.item.author; + /* clear field */ + if(ctx.field) + string_clear(ctx.field); } } -- cgit v1.2.3