[Pkg-owncloud-commits] [owncloud-client] 02/70: Fix syncing a folder with '#' in the name
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:17 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 24616bead41562966461a754603f7392fce20415
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Tue Jun 3 15:45:10 2014 +0200
Fix syncing a folder with '#' in the name
Or an url with '#'
Fixes #1838
The problem is a bug fixed in Qt5 now breaks.
In Qt4, QUrl::setPath() did not properly handle path with '#' in them
and QUrl::toString would restitute the '#'.
But csync will blindly do "uri + path" before passing the path to
VIO. because csync_update has no idea that the VIO plugin need special
encoding, the encoding cannot be done there. But csync_owncloud then
encodes the full path. So if the uri contains '#', it must not be already
encoded or there will be two encoding.
---
src/mirall/folder.cpp | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index bc0a0c4..fffe544 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -99,10 +99,21 @@ bool Folder::init()
return false;
}
- QString url = Utility::toCSyncScheme(remoteUrl().toString());
+ // We need to reconstruct the url because the path need to be fully decoded, as csync will re-encode the path:
+ // Remember that csync will just append the filename to the path and pass it to the vio plugin.
+ // csync_owncloud will then re-encode everything.
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ QUrl url = remoteUrl();
+ QString url_string = url.scheme() + QLatin1String("://") + url.authority(QUrl::EncodeDelimiters) + url.path(QUrl::FullyDecoded);
+#else
+ // Qt4 was broken anyway as it did not encode the '#' as it should have done (it was actually a provlem when parsing the path from QUrl::setPath
+ QString url_string = remoteUrl().toString();
+#endif
+ url_string = Utility::toCSyncScheme(url_string);
+
QString localpath = path();
- if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) {
+ if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url_string.toUtf8().data() ) < 0 ) {
qDebug() << "Unable to create csync-context!";
slotSyncError(tr("Unable to create csync-context"));
_csync_ctx = 0;
--
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