diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt index 8f669c69..9a0a4b30 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt @@ -48,6 +48,7 @@ class RenameRemoteFileOperation( private val oldRemotePath: String, private val newName: String, isFolder: Boolean, + val spaceWebDavUrl: String? = null, ) : RemoteOperation() { private var newRemotePath: String @@ -75,8 +76,8 @@ class RenameRemoteFileOperation( } val moveMethod: MoveMethod = MoveMethod( - url = URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(oldRemotePath)), - destinationUrl = client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(newRemotePath), + url = URL((spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(oldRemotePath)), + destinationUrl = (spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(newRemotePath), ).apply { setReadTimeout(RENAME_READ_TIMEOUT, TimeUnit.MILLISECONDS) setConnectionTimeout(RENAME_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/FileService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/FileService.kt index 2fd3c0e8..89407585 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/FileService.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/FileService.kt @@ -77,5 +77,6 @@ interface FileService : Service { oldRemotePath: String, newName: String, isFolder: Boolean, + spaceWebDavUrl: String? = null, ): RemoteOperationResult } diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/implementation/OCFileService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/implementation/OCFileService.kt index 8bbbc074..e0c6a2f6 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/implementation/OCFileService.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/implementation/OCFileService.kt @@ -123,12 +123,14 @@ class OCFileService(override val client: OwnCloudClient) : FileService { oldName: String, oldRemotePath: String, newName: String, - isFolder: Boolean + isFolder: Boolean, + spaceWebDavUrl: String?, ): RemoteOperationResult = RenameRemoteFileOperation( oldName = oldName, oldRemotePath = oldRemotePath, newName = newName, - isFolder = isFolder + isFolder = isFolder, + spaceWebDavUrl = spaceWebDavUrl, ).execute(client) }