Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow folders to be renamed to empty #17049

Open
SemiZhang opened this issue May 17, 2022 · 6 comments
Open

Allow folders to be renamed to empty #17049

SemiZhang opened this issue May 17, 2022 · 6 comments

Comments

@SemiZhang
Copy link

SemiZhang commented May 17, 2022

qBittorrent & operating system versions

qBittorrent: 4.4.2 arm64
Operating system: Debian10 (WebUI)

What is the problem?

When a file is renamed with a slash symbol, a new folder is created and the part before the slash symbol is used as the folder name.
When a folder is renamed to a single slash, the folder is deleted from the file system, but a folder with an empty name remains in the qBittorrent UI. As following:
image

Apparently this is because the full file path contains multiple slashes.
So if the folder is allowed to be renamed to empty, the display in the UI can be removed along with the folder in the file system.

@SemiZhang
Copy link
Author

This could also be as a preliminary solution for folder management.
Sometimes folders are created by mistake while adding a slash in file name. #16906 #16834

@Roardom
Copy link

Roardom commented May 18, 2022

As a temporary workaround, you can rename the folder to a dot: .. Two dots (..) also works if you want to go up a directory. Very useful undocumented features.

@SemiZhang
Copy link
Author

As a temporary workaround, you can rename the folder to a dot: .. Two dots (..) also works if you want to go up a directory. Very useful undocumented features.

Thank you for your advice.
Your method allows the contents of multiple subfolders to be placed under the main folder. But this is also for the file system, and folders with the name of a single dot will still appear in qbit UI, as following:
image
In this case, those folders named as single or double dots are not visible by file explorer.

@SemiZhang
Copy link
Author

SemiZhang commented May 18, 2022

Also I found an interesting behavior with slash in file name :

  • If a slash has been added to the end of file name, nothing will happen.
  • If a folder with empty names was created by adding a slash at the beginning of file name, than this folder will not be able to be renamed any more. Once it is being renamed, a new directory with the "new name" will become the parent directory of that folder. For exemple:
  1. Having "File.txt" under the main directory
    image
  2. Rename it to "/File.txt"
    image
  3. A new folder with empty name is created
    image
  4. Rename the created folder
    image
  5. Another new folder is created on top of the 'empty name folder'
    image

@DarkVoyage
Copy link

DarkVoyage commented May 26, 2022

The problem is caused first of all because:

  • it is allowed to input system characters in file names
  • it is allowed to change torrent structure (i.e. remove root folder)

Nothing of this should be normally allowed to do. Only renaming the root folder/file with allowed characters.

Or as an opposite you should add extended management of folders - add/remove subfolder, drag and drop.
Also consider #16994, #16271, #16011.

I have another problem. If you rename root folder while some files are locked by some process, you will get two root folders: one with new name and one with old name. It is impossible to fix this too. You can't rename both folders with same name and get the expected result (joining of folders), it will say that folder with that name already exists. I will try to find example.

@Guru1-228
Copy link

I noticed an interesting dependency, and I think this information will be useful. The slash \ and / make a big difference in this context. If you put \ in the name, it will end up in the file name and everything will break. If you specify /, it will normally change the file directory.

Sorry for the English, I use machine translation, I would have translated it worse myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants