Fix assert in UrlUtil::firstChildUrl()
ClosedPublic

Authored by dvratil on Aug 1 2017, 6:29 PM.

Details

Summary

When lastUrl = "file:///folder/" and currentUrl = "file:///folder" then currentUrl.isParentOf(lastUrl)
returns true, which causes the code to hit an assert couple lines below the check and also to not
adhere to its own documentation.

This change fixes the behavior by first normalizing both URLs and then comparing them.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dvratil created this revision.Aug 1 2017, 6:29 PM
Restricted Application added a subscriber: Frameworks. · View Herald TranscriptAug 1 2017, 6:29 PM
dfaure accepted this revision.Aug 2 2017, 7:20 AM

Patch looks good. The word "normalize" in the commit log is somewhat confusing, this is only about stripping trailing slashes, not about QUrl::NormalizePathSegments (which is another matter, maybe we need that too...).

This revision is now accepted and ready to land.Aug 2 2017, 7:20 AM
This revision was automatically updated to reflect the committed changes.