summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-01-03 21:45:02 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-01-03 21:45:02 +0100
commit584c14eb5dd080bb1c0435f48b67e10e88e34a77 (patch)
treea10d281bb78ebe1be4f154358281f397ba853239
parentbad5f90cb1b0a06c0315cf3408b3ed4c2023dc21 (diff)
clear some fields if they are set previously (some feeds define multiple date field)
-rw-r--r--sfeed.c9
1 files changed, 8 insertions, 1 deletions
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);
}
}