diff --git a/src/gui/rss/rss_imp.cpp b/src/gui/rss/rss_imp.cpp index 8a8e8820d..78ddda16a 100644 --- a/src/gui/rss/rss_imp.cpp +++ b/src/gui/rss/rss_imp.cpp @@ -355,6 +355,8 @@ void RSSImp::downloadSelectedTorrents() RssArticlePtr article = feed->getItem(item->data(Article::IdRole).toString()); if (!article) continue; + if (article->torrentUrl().isEmpty()) + continue; if (Preferences::instance()->useAdditionDialog()) AddNewTorrentDialog::show(article->torrentUrl()); else diff --git a/src/gui/rss/rssarticle.cpp b/src/gui/rss/rssarticle.cpp index a0262c1de..fbc7218bf 100644 --- a/src/gui/rss/rssarticle.cpp +++ b/src/gui/rss/rssarticle.cpp @@ -82,7 +82,7 @@ const QString& RssArticle::author() const { } const QString& RssArticle::torrentUrl() const { - return m_torrentUrl.isEmpty() ? m_link : m_torrentUrl; + return m_torrentUrl; } const QString& RssArticle::link() const { @@ -123,6 +123,6 @@ const QString& RssArticle::title() const } void RssArticle::handleTorrentDownloadSuccess(const QString &url) { - if (url == m_torrentUrl || url == m_link) + if (url == m_torrentUrl) markAsRead(); } diff --git a/src/gui/rss/rssfeed.cpp b/src/gui/rss/rssfeed.cpp index 837f5470b..6587e9123 100644 --- a/src/gui/rss/rssfeed.cpp +++ b/src/gui/rss/rssfeed.cpp @@ -364,6 +364,12 @@ void RssFeed::downloadArticleTorrentIfMatching(RssDownloadRuleList* rules, const rules->saveRulesToStorage(); // Download the torrent const QString& torrent_url = article->torrentUrl(); + if (torrent_url.isEmpty()) { + Logger::instance()->addMessage(tr("Automatic download %1 from %2 RSS feed failed because it doesn't contain a torrent or a magnet link...").arg(article->title()).arg(displayName()), Log::WARNING); + article->markAsRead(); + return; + } + Logger::instance()->addMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName())); connect(BitTorrent::Session::instance(), SIGNAL(downloadFromUrlFinished(QString)), article.data(), SLOT(handleTorrentDownloadSuccess(const QString&)), Qt::UniqueConnection); connect(article.data(), SIGNAL(articleWasRead()), SLOT(handleArticleStateChanged()), Qt::UniqueConnection);