Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 78665e8

Browse files
abelgardepJuancaG05
authored andcommitted
Add support for spaces web dav specific urls to the rename operation
1 parent 9c844aa commit 78665e8

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class RenameRemoteFileOperation(
4848
private val oldRemotePath: String,
4949
private val newName: String,
5050
isFolder: Boolean,
51+
val spaceWebDavUrl: String? = null,
5152
) : RemoteOperation<Unit>() {
5253

5354
private var newRemotePath: String
@@ -75,8 +76,8 @@ class RenameRemoteFileOperation(
7576
}
7677

7778
val moveMethod: MoveMethod = MoveMethod(
78-
url = URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(oldRemotePath)),
79-
destinationUrl = client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(newRemotePath),
79+
url = URL((spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(oldRemotePath)),
80+
destinationUrl = (spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(newRemotePath),
8081
).apply {
8182
setReadTimeout(RENAME_READ_TIMEOUT, TimeUnit.MILLISECONDS)
8283
setConnectionTimeout(RENAME_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/FileService.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ interface FileService : Service {
7777
oldRemotePath: String,
7878
newName: String,
7979
isFolder: Boolean,
80+
spaceWebDavUrl: String? = null,
8081
): RemoteOperationResult<Unit>
8182
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/services/implementation/OCFileService.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
123123
oldName: String,
124124
oldRemotePath: String,
125125
newName: String,
126-
isFolder: Boolean
126+
isFolder: Boolean,
127+
spaceWebDavUrl: String?,
127128
): RemoteOperationResult<Unit> =
128129
RenameRemoteFileOperation(
129130
oldName = oldName,
130131
oldRemotePath = oldRemotePath,
131132
newName = newName,
132-
isFolder = isFolder
133+
isFolder = isFolder,
134+
spaceWebDavUrl = spaceWebDavUrl,
133135
).execute(client)
134136
}

0 commit comments

Comments
 (0)