fix icalendar regression
This commit is contained in:
parent
25c70b363c
commit
c74d24a4ed
@ -58,7 +58,7 @@ QList<StandardFeed*> IcalParser::discoverFeeds(ServiceRoot* root, const QUrl& ur
|
||||
|
||||
QPair<StandardFeed*, QList<IconLocation>> IcalParser::guessFeed(const QByteArray& content,
|
||||
const QString& content_type) const {
|
||||
if (content_type.contains(QSL("text/calendar")) || content.contains("\r\n")) {
|
||||
if (content_type.contains(QSL("text/calendar")) || content.startsWith(QSL("BEGIN").toLocal8Bit())) {
|
||||
Icalendar calendar;
|
||||
|
||||
try {
|
||||
@ -174,8 +174,10 @@ QString IcalParser::objMessageRawContents(const QVariant& msg_element) const {
|
||||
}
|
||||
|
||||
Icalendar::Icalendar(const QByteArray& data) : FeedParser(QString::fromUtf8(data), FeedParser::DataType::Other) {
|
||||
if (!data.isEmpty()) {
|
||||
processLines(m_data);
|
||||
}
|
||||
}
|
||||
|
||||
QString Icalendar::title() const {
|
||||
return m_title;
|
||||
@ -192,6 +194,10 @@ void Icalendar::processLines(const QString& data) {
|
||||
|
||||
auto all_matches = regex.globalMatch(data);
|
||||
|
||||
if (!all_matches.hasNext()) {
|
||||
throw ApplicationException(QObject::tr("required iCal data are missing"));
|
||||
}
|
||||
|
||||
while (all_matches.hasNext()) {
|
||||
auto match = all_matches.next();
|
||||
QString component = match.captured(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user