File tree Expand file tree Collapse file tree
nextcloud/client/jobs/offlineOperations/repository
owncloud/android/datamodel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,28 +81,21 @@ class OfflineOperationsRepository(private val fileDataStorageManager: FileDataSt
8181 .forEach { dao.update(it) }
8282 }
8383
84- private fun updateOperationPath (newPath : String , nextOperation : OfflineOperationEntity ): OfflineOperationEntity ? =
85- if (newPath != nextOperation.path) {
86- nextOperation.apply {
87- type = when (type) {
88- is OfflineOperationType .CreateFile ->
89- (type as OfflineOperationType .CreateFile ).copy(
90- remotePath = newPath
91- )
92-
93- is OfflineOperationType .CreateFolder ->
94- (type as OfflineOperationType .CreateFolder ).copy(
95- path = newPath
96- )
97-
98- else -> type
99- }
100- path = newPath
101- }
102- } else {
103- null
84+ private fun updateOperationPath (newPath : String , nextOperation : OfflineOperationEntity ): OfflineOperationEntity ? {
85+ if (newPath == nextOperation.path) return null
86+
87+ val updatedType = when (val currentType = nextOperation.type) {
88+ is OfflineOperationType .CreateFile -> currentType.copy(remotePath = newPath)
89+ is OfflineOperationType .CreateFolder -> currentType.copy(path = newPath)
90+ else -> currentType
10491 }
10592
93+ return nextOperation.apply {
94+ type = updatedType
95+ path = newPath
96+ }
97+ }
98+
10699 override fun updateOperationForKeepBoth (operation : OfflineOperationEntity , newPath : String ) {
107100 updateOperationPath(newPath, operation)
108101 dao.update(operation)
Original file line number Diff line number Diff line change @@ -242,8 +242,8 @@ public void createPendingFile(
242242 final OCFile existingFile = getFileByRemotePath (remotePath );
243243 final File localFile = FileExtensionsKt .toFile (localPath );
244244 if (FileExtensionsKt .isTheSameAs (existingFile , localFile )) {
245- // In case the same file was already uploaded, do not overwrite it to avoid triggering a conflict
246- Log_OC . i ( TAG , "Creating pendingFile for an already uploaded file: keeping metadata " );
245+ Log_OC . i ( TAG , "Creating pendingFile for an already uploaded file: " +
246+ "keeping metadata to avoid triggering a conflict " );
247247 return ;
248248 }
249249
You can’t perform that action at this time.
0 commit comments