Do not use encoded URL when creating relative symlinks
Review Request #116073 - Created Feb. 26, 2014 and submitted
When creating symlinks in KNewFileMenuPrivate::_k_slotSymLink, call prettyUrl() instead url() to retrieve the user entered text. Otherwise, a percent encoded version of the URL will be used to create the symlink which of course results in the creation of an invalid symlink. Note that this call needs to probably be changed toString() in kf5 since it is using QUrl.
Follow the steps outlined in the bug report to create a symlink to a file whose path or name contains characters that are not allowed in a URL.
Hmm, KUrl isn't very good with relative urls indeed. This fix is incomplete: a symlink to a path with a "%" in it would still lead to %25. The Qt5 fix is obvious: toString(QUrl::FullyDecoded). But in kdelibs4/qt4, I can't find a good solution. path() truncates at a '#', so no go either. Ah, I found it... QUrl(kurl).toString() :-) The method I always declared "completely wrong" (for not encoding '#' in paths, breaking round-tripping) finally has its usefulness... (for the case of relative urls, rather rare in KDE code). I just committed a unittest extension to kurltest.cpp in KDE/4.12 which proves all this :)