Summary: | Allow URL for remote site to be rewritten in terms of remote:/ for better transparency | ||
---|---|---|---|
Product: | [Frameworks and Libraries] kio | Reporter: | Mario Tanev <mtanev> |
Component: | remote | Assignee: | Kevin Ottens <ervin> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Mario Tanev
2005-07-31 22:31:10 UTC
Well, I basically agree only with the first part of this report. You should be able to use remote:/Mother/Documents/cookie_recipe, and it has to redirect sanely. As for completely hiding fish:// and the behavior of "Up" I disagree. My point is using those folders you go out from the local box, so we should really keep this redirection IMHO. This way you know that you're not on the local system anymore. Those folders are more links than real folders, the remote system is definitely not a subdir of your system. I'll soon commit a fix for the first part of this wish, but I consider the remaining parts as WONTFIX because of the above reasons. SVN commit 474358 by ervin: Improve the redirection. Now we're able to redirect even if we have trailing directory information. For example remote:/Server/foo/bar will correctly redirect to protocol://server.url/foo/bar now. CCBUG:109957 M +29 -7 kio_remote.cpp --- branches/KDE/3.5/kdebase/kioslave/remote/kio_remote.cpp #474357:474358 @@ -79,10 +79,14 @@ return; } - KURL target = m_impl.findBaseURL( url.fileName() ); + int second_slash_idx = url.path().find( '/', 1 ); + QString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + KURL target = m_impl.findBaseURL( root_dirname ); kdDebug(1220) << "possible redirection target : " << target << endl; if( target.isValid() ) { + target.addPath( url.path().remove(0, second_slash_idx) ); redirection(target); finished(); return; @@ -150,14 +154,32 @@ return; } - KIO::UDSEntry entry; - if (m_impl.statNetworkFolder(entry, url.fileName())) + int second_slash_idx = url.path().find( '/', 1 ); + QString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + if ( second_slash_idx==-1 || ( (int)url.path().length() )==second_slash_idx+1 ) { - statEntry(entry); - finished(); - return; + KIO::UDSEntry entry; + if (m_impl.statNetworkFolder(entry, root_dirname)) + { + statEntry(entry); + finished(); + return; + } } - + else + { + KURL target = m_impl.findBaseURL( root_dirname ); + kdDebug( 1220 ) << "possible redirection target : " << target << endl; + if ( target.isValid() ) + { + target.addPath( url.path().remove( 0, second_slash_idx ) ); + redirection( target ); + finished(); + return; + } + } + error(KIO::ERR_MALFORMED_URL, url.prettyURL()); } SVN commit 474359 by ervin: Improve the redirection. Now we're able to redirect even if we have trailing directory information. For example remote:/Server/foo/bar will correctly redirect to protocol://server.url/foo/bar now. (forward port from 3.5) BUG:109957 M +30 -8 kio_remote.cpp --- trunk/KDE/kdebase/kioslave/remote/kio_remote.cpp #474358:474359 @@ -45,7 +45,7 @@ { // KApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); - KCmdLineArgs::init(argc, argv, "kio_remote", 0, 0, 0); + KCmdLineArgs::init(argc, argv, "kio_remote", 0L, 0L, false); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); // We want to be anonymous even if we use DCOP @@ -81,10 +81,14 @@ return; } - KURL target = m_impl.findBaseURL( url.fileName() ); + int second_slash_idx = url.path().find( '/', 1 ); + QString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + KURL target = m_impl.findBaseURL( root_dirname ); kdDebug(1220) << "possible redirection target : " << target << endl; if( target.isValid() ) { + target.addPath( url.path().remove(0, second_slash_idx) ); redirection(target); finished(); return; @@ -151,14 +155,32 @@ return; } - KIO::UDSEntry entry; - if (m_impl.statNetworkFolder(entry, url.fileName())) + int second_slash_idx = url.path().find( '/', 1 ); + QString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + if ( second_slash_idx==-1 || ( (int)url.path().length() )==second_slash_idx+1 ) { - statEntry(entry); - finished(); - return; + KIO::UDSEntry entry; + if (m_impl.statNetworkFolder(entry, root_dirname)) + { + statEntry(entry); + finished(); + return; + } } - + else + { + KURL target = m_impl.findBaseURL( root_dirname ); + kdDebug( 1220 ) << "possible redirection target : " << target << endl; + if ( target.isValid() ) + { + target.addPath( url.path().remove( 0, second_slash_idx ) ); + redirection( target ); + finished(); + return; + } + } + error(KIO::ERR_MALFORMED_URL, url.prettyURL()); } |