Fix #412 - bad logic when no author detected in ATOM entry
This commit is contained in:
parent
b2409ab745
commit
adeb9752fe
@ -23,11 +23,17 @@ AtomParser::AtomParser(const QString& data) : FeedParser(data) {
|
|||||||
AtomParser::~AtomParser() = default;
|
AtomParser::~AtomParser() = default;
|
||||||
|
|
||||||
QString AtomParser::feedAuthor() const {
|
QString AtomParser::feedAuthor() const {
|
||||||
QDomNodeList authors = m_xml.documentElement().elementsByTagNameNS(m_atomNamespace, QSL("author"));
|
QDomNodeList top_level_nodes = m_xml.documentElement().childNodes();
|
||||||
QStringList author_str;
|
QStringList author_str;
|
||||||
|
|
||||||
for (int i = 0; i < authors.size(); i++) {
|
for (int i = 0; i < top_level_nodes.size(); i++) {
|
||||||
QDomNodeList names = authors.at(i).toElement().elementsByTagNameNS(m_atomNamespace, QSL("name"));
|
auto elem = top_level_nodes.at(i).toElement();
|
||||||
|
|
||||||
|
if (elem.localName() != QSL("author") || elem.namespaceURI() != m_atomNamespace) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomNodeList names = elem.elementsByTagNameNS(m_atomNamespace, QSL("name"));
|
||||||
|
|
||||||
if (!names.isEmpty()) {
|
if (!names.isEmpty()) {
|
||||||
const QString name = names.at(0).toElement().text();
|
const QString name = names.at(0).toElement().text();
|
||||||
|
@ -28,7 +28,7 @@ QList<Message> FeedParser::messages() {
|
|||||||
try {
|
try {
|
||||||
Message new_message = extractMessage(message_item.toElement(), current_time);
|
Message new_message = extractMessage(message_item.toElement(), current_time);
|
||||||
|
|
||||||
if (new_message.m_author.isEmpty()) {
|
if (new_message.m_author.isEmpty() && !feed_author.isEmpty()) {
|
||||||
new_message.m_author = feed_author;
|
new_message.m_author = feed_author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user