[Pkg-owncloud-commits] [owncloud-client] 191/484: Propagator: Keep a meaningfull error with old server and invalid file names

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:42 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 0fde7f0e6bde80d5d57902f4bacd54ae01e3338f
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Oct 28 13:25:49 2015 +0100

    Propagator: Keep a meaningfull error with old server and invalid file names
    
    We changed the discovery code not to ignore files whose filename contains
    charachter invalid on windows. (Because newer versions of the server
    supports them)
    Servers older than 8.1 will just say "Bad Request" as an error and it's a
    regression against previous client version. So keep nice error even with
    older server.
    
    Relates to #3736
---
 src/libsync/propagateupload.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index 59ab268..0a4c411 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -197,6 +197,16 @@ void PropagateUploadFileQNAM::start()
         return;
     }
 
+    if (_propagator->account()->serverVersionInt() < 0x080100) {
+        // Server version older than 8.1 don't support these character in filename.
+        static const QRegExp invalidCharRx("[\\\\:?*\"<>|]");
+        if (_item->_file.contains(invalidCharRx)) {
+            _item->_httpErrorCode = 400; // So the entry get blacklisted
+            done(SyncFileItem::NormalError, tr("File name contains at least one invalid character"));
+            return;
+        }
+    }
+
     const QString filePath = _propagator->getFilePath(_item->_file);
 
     // remember the modtime before checksumming to be able to detect a file

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