Bug 280796

Summary: Opening multiple files with spaces and hash characters in name fails
Product: [Unmaintained] kfile Reporter: Jonathan <celloman>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: adaptee, jowenn, rakuco
Priority: HI Keywords: testcase
Version: 4.10.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jonathan 2011-08-25 19:54:16 UTC
Version:           unspecified (using KDE 4.4.5) 
OS:                Linux

Kate version 3.4.5 (wasn't in list)

I used multi-select to open three files, each with a hash character (#) in their names. Kate displayed three error messages, one for each, stating that it could not open the file. The names of the files had been mangled in the error message, replacing the last space (just before the #) with "%20".

The files were listed in the list of open documents with the incorrect names and no contents.

Reproducible: Always

Steps to Reproduce:
1) Create two (or more) text files that contain the character sequence " #". Mine were named "CPU Pinning Dump #1", "CPU Pinning Dump #2", and "CPU Pinning Dump #3". I have not tested with other file names.
2) Start Kate.
3) Bring up the Open dialog.
4) Drag a selection box around the files you created in step 1.
5) Click the Open button.

Actual Results:  
An error message is displayed for each file I chose to open, with text like this:

-----
The file /home/user/Documents/Folder/CPU Pinning Dump%20#2 could not be loaded, as it was not possible to read from it.

Check if you have read access to this file.
-----

Opening any of the files individually works fine.

Expected Results:  
The three files should have opened without issue.

OS: Linux (x86_64) release 2.6.32-33-generic
Compiler: cc
Comment 1 Joseph Wenninger 2011-08-31 10:58:17 UTC
I can reproduce it, but I don't see, that it is  kate bug, all we do is:

KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(
                                      KateDocManager::self()->editor()->defaultEncoding(),
                                      cv->document()->url().url(),
                                      QString(), m_mainWindow, i18n("Open File"));
.....

    for (KUrl::List::Iterator i = r.URLs.begin(); i != r.URLs.end(); ++i)
      lastID = openUrl( *i, r.encoding, false, false, docInfo);

No special handling for the first item or the other items in the list.
I guess it is a kdelibs problem
Comment 2 Raphael Kubo da Costa 2017-12-29 15:29:27 UTC

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