[Pkg-owncloud-commits] [owncloud-client] 55/171: SocketAPI: SHARE: Fix the paths when creating the share dialog
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.
commit 970cdcfdbbd1e4b08d6f9677f42f27e6fd1ca720
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Jan 4 11:57:51 2016 +0100
SocketAPI: SHARE: Fix the paths when creating the share dialog
The socket api uses native folder separator. We need to use QDir::cleanPath
for anything else so we only work with '/' everywhere else in the code
This fixes the sharing dialog on window.
Issue #4311
---
src/gui/socketapi.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index 4d0bf5f..b9eb7cd 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -374,7 +374,8 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
// if the folder isn't connected, don't open the share dialog
sendMessage(socket, message);
} else {
- const QString file = QDir::cleanPath(localFile).mid(shareFolder->cleanPath().length()+1);
+ const QString localFileClean = QDir::cleanPath(localFile);
+ const QString file = localFileClean.mid(shareFolder->cleanPath().length()+1);
SyncFileStatus fileStatus = this->fileStatus(shareFolder, file);
// Verify the file is on the server (to our knowledge of course)
@@ -385,17 +386,16 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
return;
}
- const QString folderForPath = shareFolder->path();
- const QString remotePath = shareFolder->remotePath() + localFile.right(localFile.count()-folderForPath.count()+1);
+ const QString remotePath = shareFolder->remotePath() + QLatin1Char('/') + file;
// Can't share root folder
- if (QDir::cleanPath(remotePath) == "/") {
+ if (remotePath == "/") {
const QString message = QLatin1String("SHARE:CANNOTSHAREROOT:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
return;
}
- SyncJournalFileRecord rec = dbFileRecord_capi(shareFolder, localFile);
+ SyncJournalFileRecord rec = dbFileRecord_capi(shareFolder, localFileClean);
bool allowReshare = true; // lets assume the good
if( rec.isValid() ) {
@@ -407,7 +407,7 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
const QString message = QLatin1String("SHARE:OK:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
- emit shareCommandReceived(remotePath, localFile, allowReshare);
+ emit shareCommandReceived(remotePath, localFileClean, allowReshare);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list