Open nick-s-b opened 5 years ago
Yes. QB should automatically append a number to the end of duplicate file or folder names when the file or folder are not expected (newly added / completed-moved torrent).
I seem to often run into the case where two queued torrents use the same root folder name. It would be so nifty if qBittorrent automatically appended a number at the end of the second torrent's root folder name.
For instance, given two torrents A and B, both storing their stuff in C, qBittorrent should create two folders named C and C1 (or something like it).
So whenever a new torrent is added for download, qBittorrent should check if there's already an existing folder with that name and then automatically rename the newest folder.
qBittorrent should check if there's already an existing folder with that name
As per @a-raccoon, this also affects single-file torrents (which get stored at the root of the Incomplete folder), not just torrents that create identical folders. So a fix would need to account for both scenarios.
And we should also take into account, if not already, all other scenarios where file folder or name collisions occur, such as when moving from the Incomplete/Temp folder to the Completed/Category destination folder. Or when moving back from the Completed/Category folder into the Incomplete/Temp folder after a Force Recheck identifies a corruption, missing file, etc. And also when adding or removing the .!qB part_file extension above.
All file/folder move and rename operations risk the potential for collision and dueling write corruption.
Got this exact same problem a lot of times. When you add torrents from magnet links, you don't know their contents. So, you have no way to plan different save path. And at the end, if the torrents have contents with same names, it's an ugly mess.
Please provide the following information
qBittorrent version and Operating System
Linux, qbittorrent 4.1.6
If on linux, libtorrent and Qt version
libtorrent-rasterbar 1:1.1.12 qt5-base 5.12.3-2
What is the problem
If you add two torrents, with different hashes but same filenames, qB will not create different folders for them and will just happily write data to the same file even if the two torrents are not the same or of the same size. Even if the files are the same, qB will not reconstruct the file correctly.
What is the expected behavior
If there are multiple torrents with different hashes but same filenames, create different folders for them
Steps to reproduce
Create two torrent files that have the same folder structure but different hashes and try to download them at the same time. qB will happily start both torrents but will write data to the same file and you'll end up with a corrupted file.