Normalize the paths in KUriFilterData.
Normalize the path in cdUp (leave only the last / in the url) before going up.
Details
- Reviewers
dfaure - Group Reviewers
Frameworks - Commits
- R241:6ab78df8c86e: Make it possible to change directory up even with trailing slashes in the url
The url of a ntfs partition is file:///d//. When I pressed cdUp, it remained in the same directory instead of going to root.
Now even if I write urls like
/d/c///////////////////////
when I press cdUp it goes up to /d/ and when I press Enter, the url stored in the history is /d/c/.
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.
I think you want QUrl::NormalizePathSegments, which would make this code simpler (and would also handle a initial URL like /d/c/../ if it can make it to that code path)
Using NormalizePathSegments.
There is something else going on with the trailing slashes in the file dialog.
If I'm in my home directory and I append slashes, they are removed, also in /, but in /home/ and other directories they are not removed, and every time I end up in /home/ the text in the url is /home/// (not in the breadcrumb).
The url in the lineedit is get from KUriFilterData, and it didn't normalize the paths, allowing trailing slashes.
Include 4 new tests and fix 2 (the ones with // in the middle of the urls).