qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
26.96k stars 3.88k forks source link

`/torrents/renameFolder` method should not require `oldPath` #21126

Open YenForYang opened 1 month ago

YenForYang commented 1 month ago

Suggestion

The current API requires the parameter oldPath to be passed. This doesn't make sense, since there is only 1 folder that the method refers to. Instead, the method should be similar to /torrents/rename, which requires only 1 parameter (name) to be passed besides the hash.

Use case

Renaming the folder without knowing the original folder name seems like a much more frequent and reasonable use case, especially when the torrent name might not match the name of the root folder.

Extra info/examples/attachments

No response

glassez commented 1 month ago

there is only 1 folder that the method refers to.

This is a false statement.

YenForYang commented 1 month ago

I guess I'm not sure if the Bittorrent specification forbids multiple directories at the root level. It might not, actually. But I've never seen any multi-file torrents with a "flat" structure. The only time I've ever seen 2 root folders in qBittorrent otherwise is when renaming the original folder (a delay causes the original folder name and new folder name to both show up).

I guess it would surely only refer to 1 folder if the "create subfolder" option was used in qBittorrent, which guarantees a root folder is created?

glassez commented 1 month ago

@YenForYang It seems that you are proceeding from the false premise that renameFolder is intended only for renaming the root folder, but this is not the case. It is purposed to rename any folder within the torrent content tree. (A torrent can have many levels of nested subfolders, even with a single root folder.)