+
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.8.0)
add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
endif()
+# When this option is enabled, a rename that is not allowed will be renamed back
+# do the original as a restoration step. Withut this option, the restoration will
+# re-download the file instead.
+# The default is off because we don't want to rename the files back behind the user's back
+# Added for IL issue #550
+option(OWNCLOUD_RESTORE_RENAME "OWNCLOUD_RESTORE_RENAME" OFF)
+if(OWNCLOUD_RESTORE_RENAME)
+ add_definitions(-DOWNCLOUD_RESTORE_RENAME=1)
+endif()
+
+
if(APPLE)
set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
endif()
}
}
-#if 0 /* We don't like the idea of renaming behind user's back, as the user may be working with the files */
-
- if (!sourceOK && !destinationOK) {
+#ifdef OWNCLOUD_RESTORE_RENAME /* We don't like the idea of renaming behind user's back, as the user may be working with the files */
+ if (!sourceOK && (!destinationOK || isRename)
+ // (not for directory because that's more complicated with the contents that needs to be adjusted)
+ && !(*it)->_isDirectory) {
// Both the source and the destination won't allow move. Move back to the original
std::swap((*it)->_file, (*it)->_renameTarget);
(*it)->_direction = SyncFileItem::Down;
(*it)->_errorString = tr("Move not allowed, item restored");
(*it)->_isRestoration = true;
qDebug() << "checkForPermission: MOVING BACK" << (*it)->_file;
+ // in case something does wrong, we will not do it next time
+ _journal->avoidRenamesOnNextSync((*it)->_file);
} else
#endif
if (!sourceOK || !destinationOK) {