[Pkg-owncloud-commits] [owncloud-client] 108/171: SyncEngine: For server older than 8.1, ignore invalid char in new directories
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:56 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 bbedeed1c5d0f4af57228cc755c9f8e2ca6248ac
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Wed Jan 13 17:49:41 2016 +0100
SyncEngine: For server older than 8.1, ignore invalid char in new directories
Server older than 8.1 cannot cope with invalid char in the filename
so we must not send them from the client. We were already checking
for new files, but not for renames or new directories.
https://github.com/owncloud/enterprise/issues/1009
---
src/libsync/propagateupload.cpp | 10 ----------
src/libsync/syncengine.cpp | 13 +++++++++++++
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index e468f87..ff6c1da 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -199,16 +199,6 @@ 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;
- }
- }
-
_propagator->_activeJobs++;
if (!_deleteExisting) {
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 6be3e93..301c0fb 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -816,6 +816,19 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
(*it)->_file = adjustRenamedPath((*it)->_file);
}
+ // Check for invalid character in old server version
+ if (_account->serverVersionInt() < 0x080100) {
+ // Server version older than 8.1 don't support these character in filename.
+ static const QRegExp invalidCharRx("[\\\\:?*\"<>|]");
+ for (auto it = _syncedItems.begin(); it != _syncedItems.end(); ++it) {
+ if ((*it)->_direction == SyncFileItem::Up &&
+ (*it)->destination().contains(invalidCharRx)) {
+ (*it)->_errorString = tr("File name contains at least one invalid character");
+ (*it)->_instruction = CSYNC_INSTRUCTION_IGNORE;
+ }
+ }
+ }
+
// Sort items per destination
std::sort(_syncedItems.begin(), _syncedItems.end());
--
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