diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-04-27 19:36:27 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-04-28 18:26:57 +0200 |
commit | 4c2b939bbb1991aaff9ad71d5aa0456793f2e787 (patch) | |
tree | ffee66e5bf8baf6e37c15569e67f050e4319a078 | |
parent | 789cc616a95f8ab841df5a007cf1115f9d63117f (diff) |
use the last href attribute value if there are multiple set
Input to reproduce:
<entry>
<link href="https://codemadness.org/a" href="https://codemadness.org/b"/>
</entry>
Old value:
"https://codemadness.org/ahttps://codemadness.org/b"
New value:
"https://codemadness.org/b"
same with RSS <enclosure url="" />
-rw-r--r-- | sfeed.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -785,12 +785,18 @@ xmlattrstart(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl) } return; } + if (attrispermalink.len && isattr(n, nl, STRP("ispermalink"))) string_clear(&attrispermalink); else if (attrrel.len && isattr(n, nl, STRP("rel"))) string_clear(&attrrel); else if (attrtype.len && isattr(n, nl, STRP("type"))) string_clear(&attrtype); + else if (tmpstr.len && + (isattr(n, nl, STRP("href")) || + isattr(n, nl, STRP("term")) || + isattr(n, nl, STRP("url")))) + string_clear(&tmpstr); /* use the last value for multiple attribute values */ } /* NOTE: this handler can be called multiple times if the data in this |