Don't append unnecessary slashes in Fetch Project dialog
ClosedPublic

Authored by elvisangelaccio on Aug 30 2016, 10:13 PM.

Details

Summary

There is a bug in the Fetch Project dialog. Every time a project is selected, an additional slash is appended to the path in the KUrlRequester. After a while this is the result: http://imgur.com/a/KIXFr

By construction of currentUrl, we know that contains a slash at the end. No need to append another one.

Test Plan

I cannot reproduce anymore the aforementioned bug.

Diff Detail

Repository
R33 KDevPlatform
Lint
Lint Skipped
Unit
Unit Tests Skipped
elvisangelaccio retitled this revision from to Don't append unnecessary slashes in Fetch Project dialog.
elvisangelaccio updated this object.
elvisangelaccio edited the test plan for this revision. (Show Details)
elvisangelaccio added a reviewer: KDevelop.
elvisangelaccio set the repository for this revision to R33 KDevPlatform.
elvisangelaccio added a project: KDevelop.
elvisangelaccio added a subscriber: KDevelop.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptAug 30 2016, 10:13 PM
brauch added a subscriber: brauch.Aug 30 2016, 10:20 PM

When you type "/home/elvis" (without trailing slash) in the box and the select a project, is there still a slash added? If yes, looks good to me, otherwise please fix that :)

In D2632#48995, @brauch wrote:

When you type "/home/elvis" (without trailing slash) in the box and the select a project, is there still a slash added? If yes, looks good to me, otherwise please fix that :)

hmm no, without trailing slash the string becomes "/home/<project name>"...

You can just keep the old code and call adjusted(QUrl::NormalizePathSegments).

In D2632#48998, @brauch wrote:

You can just keep the old code and call adjusted(QUrl::NormalizePathSegments).

But the username is always going to be cut if there is no trailing slash, so we need to add it.

Another thing, I just noticed that ProjectSourcePage::locationChanged() has the same code, though I'm not sure how to reproduce the bug there. Do you thing it's worth to move this duplicated code in another function?

Apply the same fix to ProjectSourcePage::locationChanged(), since the code is the same.

brauch accepted this revision.Aug 31 2016, 4:12 PM
brauch added a reviewer: brauch.

Looks good, go for it.

This revision is now accepted and ready to land.Aug 31 2016, 4:12 PM
mwolff added a subscriber: mwolff.Sep 3 2016, 9:12 PM

wait, before pushing this: if I cannot type "/foo/bar" into the location bar and then set a project name to get "/foo/bar/asdf", then something is broken. The duplicate "/" are just stylistically annoying, but a change in behavior as apparently introduced by this patch is imo not acceptable

brauch added a comment.Sep 3 2016, 9:27 PM

Well before, both things were broken. ;)

In D2632#49247, @mwolff wrote:

wait, before pushing this: if I cannot type "/foo/bar" into the location bar and then set a project name to get "/foo/bar/asdf", then something is broken. The duplicate "/" are just stylistically annoying, but a change in behavior as apparently introduced by this patch is imo not acceptable

As far as I can see, this was already broken before this patch. /foo/bar would just become /foo//asdf, dropping bar.

mwolff added a comment.Sep 5 2016, 2:44 PM

ah ok nvm then