KURL construction bug?

Andras Mantia amantia at freemail.hu
Fri Feb 27 21:45:02 GMT 2004


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

On Friday 27 February 2004 23:21, you wrote:
> On Fri February 27 2004 22:12, Andras Mantia wrote:
> > Hi,
> >
> >  I've just noticed a strange (for me) behavior in the KURL. I'd like to
> > construct a KURL from a string which is in a form of
> > "/path/filename#reference". If I use:
> > KURL url;
> > url.setPath(string);
> >
> > the url will have m_strPath = "/path/filename#reference" and the
> > m_strRef_encoded member empty. And the KHTML part will fail on opening
> > the file and going to the reference.
> >
> > If I use KURL url("file:" + string) everything works correctly and
> > m_strRef_encoded = "reference", m_strPath = "/path/filename".
> >
> > Is that the desired behavior and I misunderstood the documentation or
> > this is a bug in setPath() ?
>
> That's desired behavior.
>
> You have to realize that a file path and an URL are not the same thing. For
> example the path "/directory/some file" will result in the URL
> "file:/directory/some%20file". You say you have a string in the form of
> "/path/filename#reference" and it seems that the #reference part is not
> supposed the part of the filename, so I guess that you want this to be
> treated as a (rather ill formed) URL. In that case you can just assign the
> string to KURL:
> 	KURL url(string);

Yes, this is what I found. Thanks for the clarification (for everybody). I was
the one who did not understood what the documentation says. ;-)

Andras

>
> Cheers,
> Waldo

- --
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAP7peTQdfac6L/08RAr+rAJ9wAy9utXDGD0mGmPTUQ4KNVG8olwCg1TVj
cxoDNCuLquthc8s+4SJXrqo=
=f36k
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list