From 898239a42e5921a0e456da04584fbc0c3c31f4ad Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 12 Apr 2018 13:57:57 +0800 Subject: [PATCH] Fix renaming completed files Check whether the file is already downloaded before appending QB_EXT to filename. Closes #8039. --- src/gui/properties/propertieswidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index d9635fde9..db4de1d6b 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -712,7 +712,10 @@ void PropertiesWidget::renameSelectedFile() newName.chop(QB_EXT.size()); const QString oldFileName = m_torrent->fileName(fileIndex); const QString oldFilePath = m_torrent->filePath(fileIndex); - const QString newFileName = newName + (BitTorrent::Session::instance()->isAppendExtensionEnabled() ? QB_EXT : QString()); + + const bool useFilenameExt = BitTorrent::Session::instance()->isAppendExtensionEnabled() + && (m_torrent->filesProgress()[fileIndex] != 1); + const QString newFileName = newName + (useFilenameExt ? QB_EXT : QString()); const QString newFilePath = oldFilePath.leftRef(oldFilePath.size() - oldFileName.size()) + newFileName; if (oldFileName == newFileName) {