Prevent opening local files if web page is expected

This commit is contained in:
Vladimir Golovnev (Glassez)
2025-06-23 13:14:37 +03:00
parent 71af105a89
commit d379fa3035
3 changed files with 16 additions and 16 deletions

View File

@@ -441,8 +441,8 @@ void RSSWidget::openSelectedArticlesUrls()
// Mark as read
article->markAsRead();
if (!article->link().isEmpty())
QDesktopServices::openUrl(QUrl(article->link()));
if (const QUrl articleLink {article->link()}; !articleLink.isEmpty() && !articleLink.isLocalFile())
QDesktopServices::openUrl(articleLink);
}
}

View File

@@ -321,13 +321,13 @@ void SearchJobWidget::downloadTorrents(const AddTorrentOption option)
void SearchJobWidget::openTorrentPages() const
{
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
const QModelIndexList rows = m_ui->resultsBrowser->selectionModel()->selectedRows();
for (const QModelIndex &rowIndex : rows)
{
const QString descrLink = m_proxyModel->data(
m_proxyModel->index(rowIndex.row(), SearchSortModel::DESC_LINK)).toString();
if (!descrLink.isEmpty())
QDesktopServices::openUrl(QUrl::fromEncoded(descrLink.toUtf8()));
m_proxyModel->index(rowIndex.row(), SearchSortModel::DESC_LINK)).toString();
if (const QUrl descrLinkURL {descrLink}; !descrLinkURL.isEmpty() && !descrLinkURL.isLocalFile())
QDesktopServices::openUrl(descrLinkURL);
}
}