[PATCH] Multiple redirections and KDirListerCache

Hamish Rodda meddie at yoyo.its.monash.edu.au
Sun Sep 1 08:18:03 BST 2002


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.

This fixes a bug where two redirections in a row trigger the relevant asserts 
in slotRedirection() of KDirListerCache.  You may test this on my server at 
webdav://hamish.optus.nu:20080/dav/test/

I'm pretty sure this is right but can someone check? Thanks.

Index: kdirlister.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kdirlister.cpp,v
retrieving revision 1.148
diff -u -3 -p -r1.148 kdirlister.cpp
--- kdirlister.cpp      2002/08/27 13:15:09     1.148
+++ kdirlister.cpp      2002/09/01 07:12:41
@@ -910,10 +910,10 @@ void KDirListerCache::slotRedirection( K
   // Am I wrong here? And even if so, we don't need to delete them, right?
   // DF: redirection happens before listDir emits any item. Makes little 
sense otherwise.

-  DirItem *dir = itemsInUse.take( oldUrl.url() );
+  DirItem *dir = itemsInUse.take( oldUrl.url(-1) );
   Q_ASSERT( dir );

-  QPtrList<KDirLister> *listers = urlsCurrentlyListed.take( oldUrl.url() );
+  QPtrList<KDirLister> *listers = urlsCurrentlyListed.take( oldUrl.url(-1) );
   Q_ASSERT( listers );
   Q_ASSERT( !listers->isEmpty() );

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.

Cheers,

Hamish.




More information about the kfm-devel mailing list