Skip to content

Commit

Permalink
fix #1403
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed May 14, 2024
1 parent f2d3203 commit 526c4d6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/librssguard-standard/src/parsers/atomparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ QPair<StandardFeed*, QList<IconLocation>> AtomParser::guessFeed(const QByteArray
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.
QDomDocument xml_document;
QString error_msg;
Expand Down
3 changes: 3 additions & 0 deletions src/librssguard-standard/src/parsers/feedparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FeedParser::FeedParser(QString data, DataType is_xml)
}

if (m_dataType == DataType::Xml) {
// NOTE: Some XMLs have whitespace before XML declaration, erase it.
m_data = m_data.trimmed();

// XML.
QString error;

Expand Down
3 changes: 3 additions & 0 deletions src/librssguard-standard/src/parsers/rdfparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ QPair<StandardFeed*, QList<IconLocation>> RdfParser::guessFeed(const QByteArray&
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.
QDomDocument xml_document;
QString error_msg;
Expand Down
3 changes: 3 additions & 0 deletions src/librssguard-standard/src/parsers/rssparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ QPair<StandardFeed*, QList<IconLocation>> RssParser::guessFeed(const QByteArray&
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.
QDomDocument xml_document;
QString error_msg;
Expand Down
10 changes: 7 additions & 3 deletions src/librssguard/miscellaneous/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <QSslSocket>
#include <QThreadPool>
#include <QTimer>
#include <QVersionNumber>

#if defined(NO_LITE) && defined(MEDIAPLAYER_LIBMPV_OPENGL)
#include <QQuickWindow>
Expand Down Expand Up @@ -558,9 +559,11 @@ QString Application::configFolder() 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,
// 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() {
Expand Down Expand Up @@ -597,12 +600,13 @@ QStringList Application::replaceUserDataFolderPlaceholder(QStringList texts) con

QString Application::userDataHomeFolder() const {
QString pth;
static int major_version = QVersionNumber::fromString(QSL(APP_VERSION)).majorVersion();

#if defined(Q_OS_ANDROID)
return pth = IOFactory::getSystemFolder(QStandardPaths::GenericDataLocation) + QDir::separator() + QSL(APP_NAME) +
QSL(" 4");
QSL(" %1").arg(major_version);
#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

return QDir::toNativeSeparators(pth);
Expand Down

0 comments on commit 526c4d6

Please sign in to comment.