diff --git a/kioslave/desktop/kio_desktop.cpp b/kioslave/desktop/kio_desktop.cpp --- a/kioslave/desktop/kio_desktop.cpp +++ b/kioslave/desktop/kio_desktop.cpp @@ -112,7 +112,14 @@ bool DesktopProtocol::rewriteUrl(const QUrl &url, QUrl &newUrl) { newUrl.setScheme(QStringLiteral("file")); - newUrl.setPath(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + url.path()); + + QString newPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + url.path(); + + if (newPath.endsWith(QLatin1String("/"))) { + newPath.chop(1); + } + + newUrl.setPath(newPath); return true; } @@ -166,9 +173,13 @@ entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); } - // Set the target URL to the local path - QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); - entry.insert(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); + QString localPath = entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH); + if (localPath.endsWith(QLatin1String("/."))) { + localPath.chop(2); + } + entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, localPath); + // Set the target URL to the local path + entry.insert(KIO::UDSEntry::UDS_TARGET_URL, QUrl::fromLocalFile(localPath).toString()); } void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags)