Review Request: ftp server URL throws "invalid protocol" - Bug: 209031

Dawit Alemayehu adawit at kde.org
Thu Aug 26 18:20:09 BST 2010



> On 2010-08-26 16:34:56, Rolf Eike Beer wrote:
> > Why is that startsWith("ftp.") and not just startsWith("ftp")? I'm always annoyed Konqueror gets ftp5.gwdg.de wrong ;)
> 
> Mark wrote:
>     simple. If i do startsWith("ftp") then anything that starts with "ftp" will get the ftp:// prefix..
>     Besides, ftp. and ftp://ftp. is common. ftp5. is far from common if you ask me ^_^ And changing this would mean that anything before the point that contans "ftp" should get ftp:// ... i'm not sure if that's a good idea although not hard to make.
>     
>     everything before the first point then .contains("ftp") and voila.. ^_^
>     
>     But, someone else.. Is this a required change?

@Mark:
The actual fix should be to replace the "KUrlCompletion::replacedPath" call with "KURIFilter::self()->filterUri" in that function as follows:

// Use short url and web shortcut filters of the uri input filtering class...
if (!KURIFilter::self()->filterUri(url, QStringList() << "kshorturifilter" << "kurisearchfilter"))
    return;

@Rolf:
Since Konqueror already uses KURIFilter to filter user input, you can simply use the undocumented feature of the kshorturifilter plugin to solve your annoyance...

#1.) Create a $KDEHOME/share/config/kshorturifilterrc or copy the global one that comes with KDE by default.
#2.) Add the following to the file:
[Pattern]
myftpsite=ftp5.gwdg.de

[Protocol]
myftpsite=ftp://

Restart konqueror... Now whenever you type that url, ftp:// will be used instead of the default http://. You can add as many pattern/protocol associations as well as use regular expressions for the pattern. KDE comes with a pre installed global kshorturifilterrc file that contains the following:

[Pattern]
kdemailto=^(\\w+)(?:[.]\\w+)?@(\\w+)(?:[.]\\w+)+$
kdeftp=^ftp(?:\\.\\w+)?\\.\\D{2,}(?:[0-9]{1,5})?

[Protocol]
kdemailto=mailto:
kdeftp=ftp://


- Dawit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/5148/#review7229
-----------------------------------------------------------


On 2010-08-26 14:26:16, Mark wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/5148/
> -----------------------------------------------------------
> 
> (Updated 2010-08-26 14:26:16)
> 
> 
> Review request for Dolphin, kdelibs and David Faure.
> 
> 
> Summary
> -------
> 
> Read the bug report for the.. bug..
> 
> As for the fix. I had a hard time finding the right place to implement this since all was using const KUrl thus not editable... When searching deeper i ended up in making the fix in either KUrlNavigator or in KUrl itself. I decided to go for KUrlNavigator for no particular reason... I could just as well have tried it in KUrl. I hope this KUrlNavigator was the right place (either way, please do explain where is the right place and why the other one isn't the right place). 
> 
> 
> This addresses bug 209031.
>     https://bugs.kde.org/show_bug.cgi?id=209031
> 
> 
> Diffs
> -----
> 
>   /tags/KDE/4.5.0/kdelibs/kfile/kurlnavigator.cpp 1168303 
> 
> Diff: http://reviewboard.kde.org/r/5148/diff
> 
> 
> Testing
> -------
> 
> I did one simple tests on it:
> typing "ftp.nluug.nl" in the url bar and pressing enter. It changed the url to "ftp://ftp.nluug.nl" and the ftp opened just perfectly. I browsed a bit on it to see if it stays working fins and it seems to do just that.
> 
> 
> Thanks,
> 
> Mark
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100826/121884b8/attachment.htm>


More information about the kde-core-devel mailing list