Skip to content

Commit 841200e

Browse files
committed
wip
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent c461a50 commit 841200e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/src/main/java/com/nextcloud/utils/extensions/FileDataStorageManagerExtensions.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ fun FileDataStorageManager.moveFiles(ocFile: OCFile?, targetPath: String, target
8989
}
9090

9191
if (OCFile.ROOT_PATH == ocFile.fileName) {
92-
Log_OC.e(FileDataStorageManager.TAG, "moveLocalFile: cannot move root path")
92+
Log_OC.w(FileDataStorageManager.TAG, "moveLocalFile: cannot move root path")
9393
return
9494
}
9595

9696
if (ocFile.remotePath == targetPath) {
97-
Log_OC.e(FileDataStorageManager.TAG, "moveLocalFile: source and target paths are identical, skipping")
97+
Log_OC.w(FileDataStorageManager.TAG, "moveLocalFile: source and target paths are identical, skipping")
9898
return
9999
}
100100

@@ -113,12 +113,12 @@ fun FileDataStorageManager.moveFiles(ocFile: OCFile?, targetPath: String, target
113113
val accountName = user.accountName
114114
val defaultSavePath = FileStorageUtils.getSavePath(accountName)
115115

116-
val originalMediaPaths =
117-
fileDao.moveFilesInDb(oldPath, targetPath, defaultSavePath, targetParent.fileId, accountName)
118-
119116
val moved = moveLocalFiles(accountName, ocFile, defaultSavePath, targetPath)
120117
if (!moved) return
121118

119+
val originalMediaPaths =
120+
fileDao.moveFilesInDb(oldPath, targetPath, defaultSavePath, targetParent.fileId, accountName)
121+
122122
for (originalMediaPath in originalMediaPaths) {
123123
deleteFileInMediaScan(originalMediaPath)
124124
val newMediaPath = defaultSavePath + targetPath + originalMediaPath.substring(

app/src/test/java/com/owncloud/android/datamodel/MoveFilesGuardTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MoveFilesGuardTest : MoveFilesTestBase() {
2424

2525
@Test
2626
fun testMoveLocalFileWhenFileDoesNotExistShouldReturnEarlyWithoutInteractingWithDatabase() {
27-
val file = OCFile(OLD_PATH).apply { fileId = 0 }
27+
val file = OCFile(OLD_PATH).apply { fileId = -1 }
2828

2929
manager.moveLocalFile(file, TARGET_PATH, TARGET_PARENT_PATH)
3030

0 commit comments

Comments
 (0)