mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-28 16:20:34 +01:00
use some default mime type for enclosure when missing
This commit is contained in:
parent
daa889ee95
commit
b0b3acf1c2
@ -26,7 +26,7 @@
|
||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="4.1.0" date="2022-01-07"/>
|
||||
<release version="4.1.0" date="2022-01-10"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -26,10 +26,10 @@ CookieJar::CookieJar(QObject* parent) : QNetworkCookieJar(parent) {
|
||||
|
||||
// When cookies change in WebEngine, then change in main cookie jar too.
|
||||
connect(m_webEngineCookies, &QWebEngineCookieStore::cookieAdded, this, [=](const QNetworkCookie& cookie) {
|
||||
insertCookieInternal(cookie, false, true);
|
||||
//insertCookieInternal(cookie, false, true);
|
||||
});
|
||||
connect(m_webEngineCookies, &QWebEngineCookieStore::cookieRemoved, this, [=](const QNetworkCookie& cookie) {
|
||||
deleteCookieInternal(cookie, false);
|
||||
//deleteCookieInternal(cookie, false);
|
||||
});
|
||||
#endif
|
||||
|
||||
@ -124,7 +124,6 @@ bool CookieJar::insertCookieInternal(const QNetworkCookie& cookie, bool notify_o
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
if (notify_others) {
|
||||
// NOTE: Make sync one-way for now, it crashes.
|
||||
//m_webEngineCookies->setCookie(cookie);
|
||||
}
|
||||
#else
|
||||
|
@ -100,7 +100,13 @@ Message AtomParser::extractMessage(const QDomElement& msg_element, const QDateTi
|
||||
QString attribute = link.attribute(QSL("rel"));
|
||||
|
||||
if (attribute == QSL("enclosure")) {
|
||||
new_message.m_enclosures.append(Enclosure(link.attribute(QSL("href")), link.attribute(QSL("type"))));
|
||||
QString enclosure_type = link.attribute(QSL("type"));
|
||||
|
||||
if (enclosure_type.isEmpty()) {
|
||||
enclosure_type = QSL(DEFAULT_ENCLOSURE_MIME_TYPE);
|
||||
}
|
||||
|
||||
new_message.m_enclosures.append(Enclosure(link.attribute(QSL("href")), enclosure_type));
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Found enclosure"
|
||||
<< QUOTE_W_SPACE(new_message.m_enclosures.last().m_url)
|
||||
|
@ -4,5 +4,6 @@
|
||||
#define DEFAULT_FEED_ENCODING "UTF-8"
|
||||
#define DEFAULT_FEED_TYPE "RSS"
|
||||
#define FEED_INITIAL_OPML_PATTERN "feeds-%1.opml"
|
||||
#define DEFAULT_ENCLOSURE_MIME_TYPE "image/jpg"
|
||||
|
||||
#endif // STANDARD_DEFINITIONS_H
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "exceptions/applicationexception.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "network-web/webfactory.h"
|
||||
#include "services/standard/definitions.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
@ -60,6 +61,10 @@ QList<Enclosure> FeedParser::mrssGetEnclosures(const QDomElement& msg_element) c
|
||||
QString url = elem_content.attribute(QSL("url"));
|
||||
QString type = elem_content.attribute(QSL("type"));
|
||||
|
||||
if (type.isEmpty()) {
|
||||
type = QSL(DEFAULT_ENCLOSURE_MIME_TYPE);
|
||||
}
|
||||
|
||||
if (!url.isEmpty() && !type.isEmpty()) {
|
||||
enclosures.append(Enclosure(url, type));
|
||||
}
|
||||
@ -72,7 +77,7 @@ QList<Enclosure> FeedParser::mrssGetEnclosures(const QDomElement& msg_element) c
|
||||
QString url = elem_content.attribute(QSL("url"));
|
||||
|
||||
if (!url.isEmpty()) {
|
||||
enclosures.append(Enclosure(url, QSL("image/png")));
|
||||
enclosures.append(Enclosure(url, QSL(DEFAULT_ENCLOSURE_MIME_TYPE)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,10 @@ Message RssParser::extractMessage(const QDomElement& msg_element, const QDateTim
|
||||
}
|
||||
|
||||
if (!elem_enclosure.isEmpty()) {
|
||||
if (elem_enclosure_type.isEmpty()) {
|
||||
elem_enclosure_type = QSL(DEFAULT_ENCLOSURE_MIME_TYPE);
|
||||
}
|
||||
|
||||
new_message.m_enclosures.append(Enclosure(elem_enclosure, elem_enclosure_type));
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Found enclosure"
|
||||
|
Loading…
x
Reference in New Issue
Block a user