KCoreDirLister: Clean up the trailing slash as expected on remote systems
Due to QTBUG-35921 we sometimes get a trailing slash even if we expect it to be removed. This patch adds a method that makes sure the trailing slash is completely removed from the URL and returns the cleaned URL, but only if the file is in remote directoy.
The code was built around the behavior of the trailing
slash always being removed, so it was comparing URLs:
Even if the URLs point to same location, smb://aaa and smb://aaa/,
the URLs are considered as different ones.
On remote systems we do not know if the file system allows foo/bar and
foo/bar/ to be the exact same or not. On local systems we can rely on
Qt.
This fixes bug that would cause situations where the job is reusing itself for the two "different" URLs (from the point of view of the code) and asserting, as every different URL should have a new job.