kio and scheme://

Milian Wolff mail at milianw.de
Sun Nov 2 22:23:55 UTC 2014


On Sunday 02 November 2014 13:43:50 Àlex Fiestas wrote:
> Hi there
> 
> There are quite a few places where the following code is found:
> 
> if (!url.path().endsWith('/')) {
>     url.setPath(url.path() + '/');
> }

Unrelated to the below, this will also add a trailing slash to non-empty 
paths, preventing files from getting opened.

> Given an url like: 'scheme://' KUrl will return '/' as path while QUrl
> returns empty string.
> 
> This is making kio add a third slash to the url in many places (because of
> code like the one pasted before).
> 
> As a result if you open dolphin and type smb://, it will be redirected to
> smb:///.

Which is correct, no? An URL protocol is separated by ://. That's also why you 
need to type file:///tmp/bla/blub or the like. Missing a slash at the 
beginning will fail in all browsers I tested.

> Is this an intended behavior or should I start sending patches to prevent
> this from happening?
> 
> Also, even though technically the path of 'smb://' is empty, users are used
> to that format (specially given how popular htp:// is) so I would like to
> keep supporting it.

What does "http://" mean? It's a bad example as http:// is not a path protocol 
like smb or file. For these two, it is OK to add the / as default path.

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de


More information about the Kde-frameworks-devel mailing list