mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
Incorrect using TorrentHandle::rootPath() as torrent save path. #3120
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#3120
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @glassez on GitHub (Sep 23, 2015).
In most cases, the use rootPath() wrong.
Explanation and examples:
PropertiesWidget,TorrentModel and WebAPI data: We should show real torrent save path if we show it under "Save path" label. Otherwise, there is some discrepancy: the user sees one path, and when, for example, he wants to change it, he sees another path (in some cases). And yet, rootPath() returns the actual path, and we must show the target path.
rootPath() (by implication, torrent content path) should be used only for folder opening.
@Chocobo1, @sledgehammer999, @qbittorrent/qbittorrent-frequent-contributors Your comments?..
P.S. TorrentHandle::rootPath() is incorrect itself. But I'll fix it soon.
Here some examples (save path =
/user/torrents):subdir/filename.ext.rootPath() returns
/user/torrentsbut correct result is/user/torrents/subdirsubdir1/filename1.extsubdir1/filename2.extsubdir2/filename1.extrootPath() returns
/user/torrents/subdir1but correct result is/user/torrents@Chocobo1 commented on GitHub (Sep 23, 2015):
Notice that there is also a parameter in
Run external program on torrent completionthat is calledSave pathwhich also invokerootPath().I've thought of this when working on #3604, but I am confused when looking at the bittorrent spec,
it says:
What does "purely advisory" means? The
namefield can be omitted? Is the root directory a must or not?In fact, I've never seen a torrent have the structure like in the example. Our
Torrent creatoralso doesn't allow that kind of structure.I think
/user/torrentsis correct, sincesubdiris hardcoded in the torrent, I don't think we need to be smart here, I would like to hear more discussion about this too.Another acceptable answer would be
/user/torrents/subdir/filename.ext, but then, it could cause problem in theRun external program...case.Agree.
@glassez commented on GitHub (Sep 23, 2015):
I agree. On the basis of the specifications it is not possible. But we want to implement a strip first subdir (or even first few subdirs) from the file names feature (#588). The applying of this operation can lead to creation of such structure.
Here is another example:
Torrent has multiply files with paths:
subdir1/subdir2/filename1.extsubdir1/subdir2/filename2.extsubdir1/subdir2/filename3.extrootPath() returns
/user/torrents/subdir1but correct result is/user/torrents/subdir1/subdir2I don't agree. Regardless of how many files the torrent contains, the function should behave the same way. As I wrote here, the meaning of this method is " torrent content path" (by the way, I want to rename rootPath() with contentPath()). This means the directory where the useful content of the torrent (i.e. files in most cases) is placed.
@sledgehammer999 commented on GitHub (Sep 23, 2015):
Without derailing the discussion: I have been testing this. The only way to strip the root is to remap files from the torrent_info object. So yes, multifile torrents always have a "name" which acts as root folder.
As to which is correct: Well it depends on what you want to do. I think we need at least a function that will return the current and real save path. Especially for the "Save Path:" label in "General". And probably this will be usefull for "run external program". I mean
/user/torrentsin @glassez example.Question: If the temp folder is enabled should "Save path:" also show it? (since it is the current and real save path) or always show the target path(== final folder)?
@glassez commented on GitHub (Sep 24, 2015):
Save path must show target path. If it needs to show actual torrent location we should use addition field (aka "Actual save path" or something else).
For "run external program", on the contrary, it is useful to use torrent content location (at least in addition to save path)since "save path" itself bears little value to an external program.
We can only decide what we mean by "torrent content location". It should be based on the usefulness of this concept. (Forget about my previous suggestions here. It is necessary to define from scratch.)
With regard to the use of target or actual path. This should follow from the context. For example, the open the file/folder function should use the actual path. And so on.))
@sledgehammer999 commented on GitHub (Sep 24, 2015):
I was going to say the same thing.
First let's forget what is currently implemented by our TorrentHandle class.
I think we have two needs in the application, depending on what functionality is used.
Let me define 2 terms to make this discussion easier:
target path: Path where the files will be moved after they finish downloading.
current path: Path where the files are written to disk. eg the tmp folder
Obviously when temp folder is disabled current and target paths are the same.
So we need 2 functions returning those 2 values.
Target path: useful for "Save path:" field in General tab. Also when "Set location..." is chosen.
Current path: Useful for "run external program". Also for "open destionation folder" or "open file".
(possibly other usages too)
Nitpick: For "run external program" current path will be always the same as target path regardless if tmp folders are enabled, because that command is run after the content has been moved to target path.
@glassez commented on GitHub (Sep 24, 2015):
@sledgehammer999 Still, the solution must be two-dimensional:
As I said, the save path itself is marginally useful for some tasks. For example, what use is it to an external program? It is also useless for "Open containing folder" feature and so on.