Qt 4.8 QUrl.toLocalFile behavior change, impacts to KUrl (and friends)

Thiago Macieira thiago at kde.org
Fri Oct 28 10:22:07 BST 2011


On Friday, 28 de October de 2011 10:41:36 Sebastian TrĂ¼g wrote:
> > So, to be honest, the bug already existed in your code if you're finding 
> > these problems now. I just made it blatantly clear, and it's been there
> > for a  year for people to see.
> >
> > 
> >
> > I'm also calling right now KUrl's fromPathOrUrl a fatally flawed design.
> 
> Be that as it may but the fact remains that KDE potentially does not
> work with Qt 4.8. Is that really a risk worth taking? I am all for fixed
> semantics in the methods but this seems like a problematic case.

Let me repeat: the problem already existed. This just made the broken code 
more evident. You should fix it ANYWAY.

If you had a file path of:
	"/tmp/Who let the dogs out?.mp3"
or	"/tmp/Mambo #5.mp3"

In Qt 4.7, toLocalFile on those URLs above would return:

	"/tmp/Who let the dogs out"
and	"/tmp/Mambo "

Which is quite wrong already. From Qt 4.8 on, this returns empty in all cases, 
showing that you parsed the URL wrongly. It should be easier to spot where you 
made the mistake because you don't have to use specially-crafted filenames.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20111028/77a1e3de/attachment.sig>


More information about the kde-core-devel mailing list