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 oldRemotePath: String,
private val newName: String, private val newName: String,
isFolder: Boolean, isFolder: Boolean,
val spaceWebDavUrl: String? = null,
) : RemoteOperation<Unit>() { ) : RemoteOperation<Unit>() {
private var newRemotePath: String private var newRemotePath: String
@ -75,8 +76,8 @@ class RenameRemoteFileOperation(
} }
val moveMethod: MoveMethod = MoveMethod( val moveMethod: MoveMethod = MoveMethod(
url = URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(oldRemotePath)), url = URL((spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(oldRemotePath)),
destinationUrl = client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(newRemotePath), destinationUrl = (spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(newRemotePath),
).apply { ).apply {
setReadTimeout(RENAME_READ_TIMEOUT, TimeUnit.MILLISECONDS) setReadTimeout(RENAME_READ_TIMEOUT, TimeUnit.MILLISECONDS)
setConnectionTimeout(RENAME_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS) setConnectionTimeout(RENAME_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)

View File

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

View File

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