Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/5064
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Detection of server-side folder renames

Folder renames made on the server have been detected during synchronization by also comparing the remote path, keeping the local file list aligned with the server.

https://github.com/owncloud/android/issues/5014
https://github.com/owncloud/android/pull/5064
2 changes: 1 addition & 1 deletion changelog/unreleased/5068
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bugfix: Prevent privacy policy WebView from navigating away and handle non-web URL schemes
Bugfix: Prevent privacy policy WebView from navigating to external URLs

Navigation within the privacy policy WebView has been restricted to the initial URL. All link clicks are now routed to the system browser or the appropriate external app.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ class OCFileRepository(

})
} else if (localChildToSync.etag != remoteChild.etag ||
localChildToSync.remotePath != remoteChild.remotePath ||
localChildToSync.localModificationTimestamp > remoteChild.lastSyncDateForData!! ||
isActionSetFolderAvailableOfflineOrSynchronize ||
shareMetadataChanged(localChildToSync, remoteChild)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,75 @@ class OCFileRepositoryTest {
}
}

@Suppress("MaxLineLength")
@Test
fun `refreshFolder returns a list with the OCFile that changed when the etag matches but remote path changed`() {
Comment thread
joragua marked this conversation as resolved.
Resolved
val renamedRemotePath = "/Folder/PhotosRenamed/"
val ocParentFolderWithoutSpaceId = OC_PARENT_FOLDER_WITH_SPACE_ID.copy(spaceId = null)
val remoteFolderChild = OC_FOLDER_WITH_SPACE_ID.copy(spaceId = null, remotePath = renamedRemotePath)
val expectedFolderChild = OC_FOLDER_WITH_SPACE_ID.copy(remotePath = renamedRemotePath)
every {
remoteFileDataSource.refreshFolder(
remotePath = OC_PARENT_FOLDER_WITH_SPACE_ID.remotePath,
accountName = OC_PARENT_FOLDER_WITH_SPACE_ID.owner,
spaceWebDavUrl = OC_SPACE_PERSONAL.root.webDavUrl
)
} returns listOf(ocParentFolderWithoutSpaceId, remoteFolderChild)

every {
localFileDataSource.getFileByRemotePath(
remotePath = OC_PARENT_FOLDER_WITH_SPACE_ID.remotePath,
owner = OC_PARENT_FOLDER_WITH_SPACE_ID.owner,
spaceId = OC_PARENT_FOLDER_WITH_SPACE_ID.spaceId
)
} returns OC_PARENT_FOLDER_WITH_SPACE_ID

every {
localFileDataSource.getFolderContent(
folderId = OC_PARENT_FOLDER_WITH_SPACE_ID.id!!
)
} returns listOf(OC_FOLDER_WITH_SPACE_ID)

every {
localFileDataSource.saveFilesInFolderAndReturnTheFilesThatChanged(
listOfFiles = listOf(expectedFolderChild),
folder = OC_PARENT_FOLDER_WITH_SPACE_ID,
)
} returns listOf(expectedFolderChild)

val listOfFiles = ocFileRepository.refreshFolder(
OC_PARENT_FOLDER_WITH_SPACE_ID.remotePath,
OC_PARENT_FOLDER_WITH_SPACE_ID.owner,
OC_PARENT_FOLDER_WITH_SPACE_ID.spaceId,
false
)
assertEquals(listOf(expectedFolderChild), listOfFiles)

verify(exactly = 1) {
localSpacesDataSource.getWebDavUrlForSpace(
spaceId = OC_PARENT_FOLDER_WITH_SPACE_ID.spaceId,
accountName = OC_PARENT_FOLDER_WITH_SPACE_ID.owner
)
remoteFileDataSource.refreshFolder(
remotePath = OC_PARENT_FOLDER_WITH_SPACE_ID.remotePath,
accountName = OC_PARENT_FOLDER_WITH_SPACE_ID.owner,
spaceWebDavUrl = OC_SPACE_PERSONAL.root.webDavUrl
)
localFileDataSource.getFileByRemotePath(
remotePath = OC_PARENT_FOLDER_WITH_SPACE_ID.remotePath,
owner = OC_PARENT_FOLDER_WITH_SPACE_ID.owner,
spaceId = OC_PARENT_FOLDER_WITH_SPACE_ID.spaceId
)
localFileDataSource.getFolderContent(
folderId = OC_PARENT_FOLDER_WITH_SPACE_ID.id!!
)
localFileDataSource.saveFilesInFolderAndReturnTheFilesThatChanged(
listOfFiles = listOf(expectedFolderChild),
folder = OC_PARENT_FOLDER_WITH_SPACE_ID,
)
}
}

@Suppress("MaxLineLength")
@Test
fun `refreshFolder returns an empty list of OCFiles when folder and its content already exists in database but there are additional files in conflict in local to be removed`() {
Expand Down