Version: (using KDE KDE 3.5.1)
Installed from: Compiled From Sources
- have a file name containing a special character like "#" or even worse "/"
- have it in your current slocate db (updatedb)
- search the directory with kfind where the file is inside using the file index (slocate)
- the kfind result contains this file with invalid url
"test#%20asdf" is reported as "test" with 0 bytes file size and 0 modification time (=1.1.1970).
This comes from incorrect usage of KURL in kquery.cpp
KURLs are created directly from the slocate search result (which shows the special characters, e.g. "#").
For example KURL( "/path/to/test#asdf" ) is an invalid url.
It should rather be KURL::fromPathOrURL( "/path/to/test#asdf" ).
Quotation from KURL reference:
KURL KURL::fromPathOrURL ( const QString & text )[static]
Creates a KURL object from a QString representing either an absolute path or a real URL.
Use this method instead of
QString someDir = ...
KURL url = someDir;
Otherwise some characters (e.g. the '#') won't be encoded properly.
Created attachment 14648 [details]
fixes the bug for kde 3.5.1
the problem doesn't seem to be solved on current svn.
SVN commit 607835 by mkoller:
fix KURL usage with filenames including special chars
Patch provided by Georg Hennig
M +1 -1 kquery.cpp
--- branches/KDE/3.5/kdebase/kfind/kquery.cpp #607834:607835
@@ -153,7 +153,7 @@
for (; it != end; ++it)
- file = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, KURL(*it));
+ file = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, KURL::fromPathOrURL(*it));