1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Add support for spaces web dav specific urls to the rename operation

This commit is contained in:
Abel García de Prada 2023-01-19 08:19:34 +01:00 committed by Juan Carlos Garrote
parent 9c844aae7e
commit 78665e8cb0
3 changed files with 8 additions and 4 deletions

View File

@ -48,6 +48,7 @@ class RenameRemoteFileOperation(
private val oldRemotePath: String,
private val newName: String,
isFolder: Boolean,
val spaceWebDavUrl: String? = null,
) : RemoteOperation<Unit>() {
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)

View File

@ -77,5 +77,6 @@ interface FileService : Service {
oldRemotePath: String,
newName: String,
isFolder: Boolean,
spaceWebDavUrl: String? = null,
): RemoteOperationResult<Unit>
}

View File

@ -123,12 +123,14 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
oldName: String,
oldRemotePath: String,
newName: String,
isFolder: Boolean
isFolder: Boolean,
spaceWebDavUrl: String?,
): RemoteOperationResult<Unit> =
RenameRemoteFileOperation(
oldName = oldName,
oldRemotePath = oldRemotePath,
newName = newName,
isFolder = isFolder
isFolder = isFolder,
spaceWebDavUrl = spaceWebDavUrl,
).execute(client)
}