This commit is contained in:
Martin Rotter 2024-05-14 09:24:46 +02:00
parent f2d3203df1
commit 526c4d62d3
5 changed files with 19 additions and 3 deletions

View File

@ -238,6 +238,9 @@ QPair<StandardFeed*, QList<IconLocation>> AtomParser::guessFeed(const QByteArray
xml_contents_encoded = QString::fromUtf8(content); xml_contents_encoded = QString::fromUtf8(content);
} }
// NOTE: Some XMLs have whitespace before XML declaration, erase it.
xml_contents_encoded = xml_contents_encoded.trimmed();
// Feed XML was obtained, guess it now. // Feed XML was obtained, guess it now.
QDomDocument xml_document; QDomDocument xml_document;
QString error_msg; QString error_msg;

View File

@ -22,6 +22,9 @@ FeedParser::FeedParser(QString data, DataType is_xml)
} }
if (m_dataType == DataType::Xml) { if (m_dataType == DataType::Xml) {
// NOTE: Some XMLs have whitespace before XML declaration, erase it.
m_data = m_data.trimmed();
// XML. // XML.
QString error; QString error;

View File

@ -188,6 +188,9 @@ QPair<StandardFeed*, QList<IconLocation>> RdfParser::guessFeed(const QByteArray&
xml_contents_encoded = QString::fromUtf8(content); xml_contents_encoded = QString::fromUtf8(content);
} }
// NOTE: Some XMLs have whitespace before XML declaration, erase it.
xml_contents_encoded = xml_contents_encoded.trimmed();
// Feed XML was obtained, guess it now. // Feed XML was obtained, guess it now.
QDomDocument xml_document; QDomDocument xml_document;
QString error_msg; QString error_msg;

View File

@ -188,6 +188,9 @@ QPair<StandardFeed*, QList<IconLocation>> RssParser::guessFeed(const QByteArray&
xml_contents_encoded = QString::fromUtf8(content); xml_contents_encoded = QString::fromUtf8(content);
} }
// NOTE: Some XMLs have whitespace before XML declaration, erase it.
xml_contents_encoded = xml_contents_encoded.trimmed();
// Feed XML was obtained, guess it now. // Feed XML was obtained, guess it now.
QDomDocument xml_document; QDomDocument xml_document;
QString error_msg; QString error_msg;

View File

@ -43,6 +43,7 @@
#include <QSslSocket> #include <QSslSocket>
#include <QThreadPool> #include <QThreadPool>
#include <QTimer> #include <QTimer>
#include <QVersionNumber>
#if defined(NO_LITE) && defined(MEDIAPLAYER_LIBMPV_OPENGL) #if defined(NO_LITE) && defined(MEDIAPLAYER_LIBMPV_OPENGL)
#include <QQuickWindow> #include <QQuickWindow>
@ -558,9 +559,11 @@ QString Application::configFolder() const {
} }
QString Application::userDataAppFolder() const { QString Application::userDataAppFolder() const {
static int major_version = QVersionNumber::fromString(QSL(APP_VERSION)).majorVersion();
// In "app" folder, we would like to separate all user data into own subfolder, // In "app" folder, we would like to separate all user data into own subfolder,
// therefore stick to "data" folder in this mode. // therefore stick to "data" folder in this mode.
return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("data4")); return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("data%1").arg(major_version));
} }
QString Application::userDataFolder() { QString Application::userDataFolder() {
@ -597,12 +600,13 @@ QStringList Application::replaceUserDataFolderPlaceholder(QStringList texts) con
QString Application::userDataHomeFolder() const { QString Application::userDataHomeFolder() const {
QString pth; QString pth;
static int major_version = QVersionNumber::fromString(QSL(APP_VERSION)).majorVersion();
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
return pth = IOFactory::getSystemFolder(QStandardPaths::GenericDataLocation) + QDir::separator() + QSL(APP_NAME) + return pth = IOFactory::getSystemFolder(QStandardPaths::GenericDataLocation) + QDir::separator() + QSL(APP_NAME) +
QSL(" 4"); QSL(" %1").arg(major_version);
#else #else
return pth = configFolder() + QDir::separator() + QSL(APP_NAME) + QSL(" 4"); return pth = configFolder() + QDir::separator() + QSL(APP_NAME) + QSL(" %1").arg(major_version);
#endif #endif
return QDir::toNativeSeparators(pth); return QDir::toNativeSeparators(pth);