From 6f498aea3b379d65049645edfa7d4c8133e954a0 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 24 Jul 2015 10:02:18 +0200 Subject: [PATCH] Do not open the share dialog if the user tries to share the root folder --- src/gui/socketapi.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 411458ee8..9e24fa604 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -420,6 +420,13 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket) const QString folderForPath = shareFolder->path(); const QString remotePath = shareFolder->remotePath() + localFile.right(localFile.count()-folderForPath.count()+1); + // Can't share root folder + if (QDir::cleanPath(remotePath) == "/") { + const QString message = QLatin1String("SHARE:CANNOTSHAREROOT:")+QDir::toNativeSeparators(localFile); + sendMessage(socket, message); + return; + } + SyncJournalFileRecord rec = dbFileRecord_capi(shareFolder, localFile); bool allowReshare = true; // lets assume the good