Bug 46320 - HTML output is wrong for filenames with spaces
Summary: HTML output is wrong for filenames with spaces
Status: CLOSED FIXED
Alias: None
Product: kfind
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Eric Coquelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-10 10:48 UTC by 0mecir
Modified: 2003-03-05 10:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 0mecir 2002-08-10 10:39:27 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kfind
Version:           KDE 3.0.2 
Severity:          normal
Installed from:    Mandrake RPMs
Compiler:          gcc 2.96
OS:                Linux
OS/Compiler notes: Not Specified

When I search for files in KFind and files whose name include spaces are included in the results:
Saving search results as a HTML page produce wrong page (filename stripped after first space...).

To reproduce:
- get some files with spaces in their name
- do a search that finds those files
- save results as a HTML page
- view that page...

---
Tomas

(Submitted via bugs.kde.org)
Comment 1 Daniel Naber 2002-10-28 13:27:22 UTC
If someone fixes it, please also remove the <!DOCTYPE %1>, which should be 
replaced by a "generated by kfind" comment. 
 
Comment 2 domseichter 2003-03-03 13:26:43 UTC
Fixed in HEAD. Diff: 
 
Index: kfwin.cpp 
=================================================================== 
RCS file: /home/kde/kdebase/kfind/kfwin.cpp,v 
retrieving revision 1.66 
diff -u -p -r1.66 kfwin.cpp 
--- kfwin.cpp	10 Sep 2002 09:51:20 -0000	1.66 
+++ kfwin.cpp	2 Mar 2003 19:13:24 -0000 
@@ -228,7 +228,7 @@ void KfindWindow::saveResults() 
       item = firstChild(); 
       while(item != NULL) 
 	{ 
-	  QString path=((KfFileLVI*)item)->fileitem.url().url(); 
+	  QString path=((KfFileLVI*)item)->fileitem.url().prettyURL(); 
 	  QString pretty=((KfFileLVI*)item)->fileitem.url().prettyURL(); 
 	  stream << QString::fromLatin1("<DT><A HREF=\"%1\">%2</A>\n") 
 	    .arg(path).arg(pretty); 
@@ -241,7 +241,7 @@ void KfindWindow::saveResults() 
       item = firstChild(); 
       while(item != NULL) 
       { 
-	QString path=((KfFileLVI*)item)->fileitem.url().url(); 
+	QString path=((KfFileLVI*)item)->fileitem.url().prettyURL(); 
 	stream << path << endl; 
 	item = item->nextSibling(); 
       } 
 
Comment 3 Waldo Bastian 2003-03-03 13:33:18 UTC
Subject: Re: kdebase/kfind

On Monday 03 March 2003 13:23, Dominik Seichter wrote:
> CVS commit by domseichter:
>
> fix for bug 46320: filenames containing spaces are saved correctly into the
> html output file.

This fix looks rather wrong to me. Why do you think that you have to use 
prettyURL() here?

Cheers,
Waldo
Comment 4 domseichter 2003-03-03 13:37:04 UTC
Subject: Re: kdebase/kfind

Am Montag, 3. März 2003 13:32 schrieb Waldo Bastian:
> On Monday 03 March 2003 13:23, Dominik Seichter wrote:
> > CVS commit by domseichter:
> >
> > fix for bug 46320: filenames containing spaces are saved correctly into
> > the html output file.
>
> This fix looks rather wrong to me. Why do you think that you have to use
> prettyURL() here?
Well, because it works for me. I can't give a better reason though. 
I asked an core-devel yesterday and no one complained, so I thought it is save 
to commit :-). If this fix makes things worse, I can revert it of course.

CU Dom
Comment 5 domseichter 2003-03-05 10:18:31 UTC
A fixed patch was commited to HEAD and Branch. prettyURL() was removed from 
my patch, because it was _really_ wrong. 
 
The problem was that a space is encoded as "%20" and the following code was 
used to write the link to the file. You will see that we there are two %2 in the  
line now, if a file containing a space is written.  
 
stream << QString::fromLatin1("<DT><A HREF=\"%1\">%2</A>\n") 
            .arg(path).arg(pretty);