File dialog won't open files whose names start with "~". E.g., create a file named "~foo.txt" and try to open it in any KDE app.
The tilde character is the UNIX way to reference the home directory. http://en.wikipedia.org/wiki/Tilde#Directories_and_URLs
*** Bug 262385 has been marked as a duplicate of this bug. ***
Found another filename that doesn't work: ".txt (I know it's a special character, but it's a valid filename.)
Dima, that's bug 185433.
*** Bug 144220 has been marked as a duplicate of this bug. ***
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1831
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/489
Git commit 42d0c8b9be209c20538a4cb0b3865b676aa4fc44 by Akseli Lahtinen. Committed on 13/03/2025 at 10:55. Pushed by akselmo into branch 'master'. KShell:tildeExpand: Return filename if homedir is empty Often cache and automatic backup files are saved with ~ prefix. Our tilde-expand method returns empty in cases where the `~file` does not match an username. In those cases, just return the filename instead. Also updated autotest. M +1 -0 autotests/kshelltest.cpp M +5 -1 src/lib/util/kshell.cpp https://invent.kde.org/frameworks/kcoreaddons/-/commit/42d0c8b9be209c20538a4cb0b3865b676aa4fc44
What if there is a user named "file"? Then I'm still not allowed to open a file named "~file"? That's even more inconsistent now. Also, we're talking about a file dialog, not a UNIX shell. If it's going to support tildes, should it also support quotes, backslashes, dollar signs, and so on?
Also, regardless of any special characters, if I *click* a file, then that's the file that should be opened. It's pretty simple.
> What if there is a user named "file"? Then there's a potential looming disaster, because depending on how your apps were programmed, when they try to save or delete such a file, they may end up copying it into the "file" user's home directory (confusing and wrong) or deleting the home directory entirely (utter catastrophe). Such files are too dangerous and should not be named in that way. We already warn against this in our new file creator dialog, and will soon make it impossible to do anyway if the proposed name of the new file actually does overlap with the name of an existing user's account.
Git commit 26292d7d97d64c029424c5cf610053f2d8eb2e74 by Akseli Lahtinen. Committed on 14/03/2025 at 16:47. Pushed by akselmo into branch 'master'. KNewFileMenu: Forbid saving file or folder with ~USERNAME as name When creating new file or directory, check that any name which starts with ~ does not resolve into a home directory on the machine. This is due to an UNIX convention where "~user" can resolve into "/home/user". On Windows we do not have to worry about resolving this file. Added an autotest for this as well. M +81 -18 autotests/knewfilemenutest.cpp M +21 -5 src/filewidgets/knewfilemenu.cpp https://invent.kde.org/frameworks/kio/-/commit/26292d7d97d64c029424c5cf610053f2d8eb2e74