[Pkg-owncloud-commits] [owncloud-client] 64/164: Sharing: Fix for folders containing &. #2892

Sandro Knauß hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:53 UTC 2015


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 842e5ba5e009f3e722f2f1efaf1298cbe6d8930e
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Thu Feb 26 09:40:54 2015 +0100

    Sharing: Fix for folders containing &. #2892
---
 shell_integration/nautilus/syncstate.py |  8 +++++---
 src/gui/sharedialog.cpp                 | 14 ++++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py
index 6e1b8ae..0b5e37d 100755
--- a/shell_integration/nautilus/syncstate.py
+++ b/shell_integration/nautilus/syncstate.py
@@ -21,8 +21,10 @@ from gi.repository import GObject, Nautilus
 # do not touch the following line.
 appname = 'ownCloud'
 
-def get_local_path(path):
-    return path.replace("file://", "")
+def get_local_path(url):
+    if url[0:7] == 'file://':
+        url = url[7:]
+    return urllib.unquote(url)
 
 def get_runtime_dir():
     """Returns the value of $XDG_RUNTIME_DIR, a directory path.
@@ -254,7 +256,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
         if item.get_uri_scheme() != 'file':
             return
 
-        filename = urllib.unquote(item.get_uri()[7:])
+        filename = get_local_path(item.get_uri())
         if item.is_directory():
             filename += '/'
 
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index be620cb..b81338d 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -603,13 +603,19 @@ void OcsShareJob::start()
     QNetworkRequest req;
     req.setRawHeader("OCS-APIREQUEST", "true");
     req.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
-    QBuffer *buffer = new QBuffer;
 
-    QStringList tmp;
+    // Url encode the _postParams and put them in a buffer.
+    QByteArray postData;
     Q_FOREACH(auto tmp2, _postParams) {
-        tmp.append(tmp2.first + "=" + tmp2.second);
+        if (! postData.isEmpty()) {
+            postData.append("&");
+        }
+        postData.append(QUrl::toPercentEncoding(tmp2.first));
+        postData.append("=");
+        postData.append(QUrl::toPercentEncoding(tmp2.second));
     }
-    buffer->setData(tmp.join("&").toAscii());
+    QBuffer *buffer = new QBuffer;
+    buffer->setData(postData);
 
     auto queryItems = _url.queryItems();
     queryItems.append(qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));

-- 
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