Bug 189935

Summary: File dialog problems when selecting files with quote characters
Product: [Frameworks and Libraries] kdelibs Reporter: Brendon Higgins <brendon>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Severity: normal CC: adawit, asenlekoff, indrid.warm, walch.martin
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Brendon Higgins 2009-04-18 05:21:15 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

Create a file called test"thing and try to open it in any KDE program, e.g. Kate, through the Open File dialog. The dialog will not recognise when you click on the "Okay" button. It'll just ignore you.

Create a file called test"thing"test and try similar. The dialog will recognise clicking the "Okay" button, but the program will attempt to open a file called thing, not test"thing"test.

Clearly the file dialog is attempting to interpret the quote marks rather than escape them (somehow). I realise there is a utility of this interpretation when selecting multiple files at once. However, as filenames with quote marks are perfectly valid (and not unheard of, I can imagine a file called A "Modest" Proposal.txt as an example), this situation needs to be resolved somehow. It's easy to create a file that apps will be unable to open, and it would not be obvious at all to the novice as to why.
Comment 1 George T 2010-05-30 13:13:46 UTC
I can confirm this happens, and it's similarly with the save dialog. Try to save a file called
abc "xyz"
and the file will be saves with the name xyz. Everything else is ignored.
Comment 2 Asen Lekov 2011-11-24 21:19:01 UTC
I also confirm this with the save dialog, but when i create file from context menu in Dolphin, i choose Create New -> Text file... and when i type test"thing or test"thing"test. 
About creating new file with one of those names up, i write on console: 

kate test"thing"test 

and kate opens new file with name testthingtest.
Comment 3 Brendon Higgins 2011-11-24 21:34:38 UTC
Hi Asen,

(In reply to comment #2)
> About creating new file with one of those names up, i write on console: 
> kate test"thing"test 
> and kate opens new file with name testthingtest.

I'm almost certain that what is happening in that case is the bash interpreter (or your shell of choice) is stripping the quote characters in its normal way. This is expected. The command you should try is
kate 'test"thing"test'
This will cause the shell to take the argument in the single quotes literally, and pass test"thing"test to kate. When I run that command, kate makes a new file with those double quote marks, as expected. So, that particular behaviour is not related to this bug.

Comment 4 Myriam Schweingruber 2011-11-25 21:24:54 UTC
Confirmed with Kate on KDE 4.7.3, Kubuntu 11.10:

creating a file kate 'thing"test' opens a file with that name, but doesn't let me save it.
Creating a file with kate 'test"thing"test' opens a file with that name, but when I save it I end up with a file named thing.
Comment 5 Martin Walch 2012-04-07 14:59:15 UTC
This is still present in KDE SC 4.8.2. Some other funny things that can happen:

- There is a file 'a "b"'. You will not be able to open it at all.
- There is a file 'a "b"' and a folder 'b'. Clicking on the file opens the folder.
- There is a file '"'. Nothing happens when clicking on it.
- There is a file '"a" "b"' and two folders 'a' and 'b'. Clicking on the file causes an error message telling that you can not select more than one folder at once.
- Similar strange effects happen with a file named '~'. Actually, when opening such a file e. g. in Kate and then saving this with "Save As", the folder /home is opened.

No problems appear when opening a file from e. g. within Konqueror.
Comment 6 Dawit Alemayehu 2013-06-16 21:06:19 UTC
Line #1641 at kdelibs/kfile/kfilewidget.cpp contains the following statement:

// FIXME: current implementation drawback: a filename can't contain quotes

Unless that tokenize function is fixed, this issue will remain.
Comment 7 Dawit Alemayehu 2013-06-18 04:56:59 UTC

*** This bug has been marked as a duplicate of bug 185433 ***