diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index ab5c687cc..54de44920 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -661,9 +661,7 @@ QString Session::tempPath() const QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const { if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder()) - return tempPath() - + QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name()) - + '/'; + return tempPath() + torrentInfo.name() + '/'; return tempPath(); } diff --git a/src/base/bittorrent/torrenthandleimpl.cpp b/src/base/bittorrent/torrenthandleimpl.cpp index 3cc6f783c..85c750a6a 100644 --- a/src/base/bittorrent/torrenthandleimpl.cpp +++ b/src/base/bittorrent/torrenthandleimpl.cpp @@ -185,17 +185,15 @@ InfoHash TorrentHandleImpl::hash() const QString TorrentHandleImpl::name() const { - QString name = m_name; - if (!name.isEmpty()) return name; - - name = QString::fromStdString(m_nativeStatus.name); - if (!name.isEmpty()) return name; + if (!m_name.isEmpty()) + return m_name; if (hasMetadata()) - { - name = QString::fromStdString(m_torrentInfo.nativeInfo()->orig_files().name()); - if (!name.isEmpty()) return name; - } + return m_torrentInfo.name(); + + const QString name = QString::fromStdString(m_nativeStatus.name); + if (!name.isEmpty()) + return name; return m_hash; } diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index 654e2b847..1c29ff15e 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -170,7 +170,7 @@ InfoHash TorrentInfo::hash() const QString TorrentInfo::name() const { if (!isValid()) return {}; - return QString::fromStdString(m_nativeInfo->name()); + return QString::fromStdString(m_nativeInfo->orig_files().name()); } QDateTime TorrentInfo::creationDate() const