[PATCH] Multiple redirections and KDirListerCache

David Faure david at mandrakesoft.com
Mon Sep 2 10:31:08 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 01 September 2002 09:18, Hamish Rodda wrote:
> Ok, I have nailed the cause of bug #46849 - when redirecting, KDirListerCache 
> looks up URLs without removing trailing slashes, but it remembers them by 
> removing the trailing slashes.  The following pach changes the lookup to also 
> remove trailing slashes.
Good catch!

Here's an equivalent, but slightly more efficient / consistent patch:

Index: kdirlister.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kdirlister.cpp,v
retrieving revision 1.148
diff -u -p -r1.148 kdirlister.cpp
- --- kdirlister.cpp      2002/08/27 13:15:09     1.148
+++ kdirlister.cpp      2002/09/02 09:28:59
@@ -904,6 +904,7 @@ void KDirListerCache::slotRedirection( K
 {
   Q_ASSERT( job );
   KURL oldUrl = static_cast<KIO::ListJob *>( job )->url();
+  oldUrl.adjustPath(-1);
   kdDebug(7004) << k_funcinfo << oldUrl.prettyURL() << " -> " << url.prettyURL() << endl;

   // I don't think there can be dirItems that are childs of oldUrl.

> Now, the next issue is that KDirListerCache does not check to see if the 
> redirection URL is actually a directory with stat(), resulting in "file or 
> directory not found" when a direction happens to a file rather than a 
> directory, as is the case at webdav://okmaybe.com/ - Is this behaviour 
> "wrong"?  It's such a corner case that it's pretty much academic, however.

Hmmmm.... why didn't a stat() happen in the first place (before starting to list
the dir) ? If a stat() happens first, then the redirection can say "it's a file".
After we start listing, it's too late.

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KOffice-1.2-rc1 is out. ftp://ftp.kde.org/pub/kde/unstable/koffice-1.2-rc1/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9cy/c72KcVAmwbhARApODAJ9ZMxIyIyj8kmHMWlAZT+XgCVJeawCgq5Pe
JHn2gJM9hlKbJU0Yx2L2xc4=
=FOk/
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list