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

Commit a65a82c

Browse files
abelgardepJuancaG05
authored andcommitted
Adapt the propfind to work with specific webdavurl from the space
1 parent 45f5365 commit a65a82c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ import java.net.URL
4848
* @author David González Verdugo
4949
*/
5050
class ReadRemoteFolderOperation(
51-
val remotePath: String
51+
val remotePath: String,
52+
val spaceWebDavUrl: String? = null,
5253
) : RemoteOperation<ArrayList<RemoteFile>>() {
5354

5455
/**
@@ -61,7 +62,7 @@ class ReadRemoteFolderOperation(
6162
PropertyRegistry.register(OCShareTypes.Factory())
6263

6364
val propfindMethod = PropfindMethod(
64-
URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(remotePath)),
65+
getFinalWebDavUrl(),
6566
DavConstants.DEPTH_1,
6667
DavUtils.allPropset
6768
)
@@ -107,5 +108,11 @@ class ReadRemoteFolderOperation(
107108
}
108109
}
109110

111+
private fun getFinalWebDavUrl(): URL {
112+
val baseWebDavUrl = spaceWebDavUrl ?: client.userFilesWebDavUri.toString()
113+
114+
return URL(baseWebDavUrl + WebdavUtils.encodePath(remotePath))
115+
}
116+
110117
private fun isSuccess(status: Int): Boolean = status.isOneOf(HTTP_OK, HTTP_MULTI_STATUS)
111118
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ interface FileService : Service {
6161
): RemoteOperationResult<RemoteFile>
6262

6363
fun refreshFolder(
64-
remotePath: String
64+
remotePath: String,
65+
spaceWebDavUrl: String? = null,
6566
): RemoteOperationResult<ArrayList<RemoteFile>>
6667

6768
fun removeFile(

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
@@ -98,10 +98,12 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
9898
).execute(client)
9999

100100
override fun refreshFolder(
101-
remotePath: String
101+
remotePath: String,
102+
spaceWebDavUrl: String?,
102103
): RemoteOperationResult<ArrayList<RemoteFile>> =
103104
ReadRemoteFolderOperation(
104-
remotePath = remotePath
105+
remotePath = remotePath,
106+
spaceWebDavUrl = spaceWebDavUrl,
105107
).execute(client)
106108

107109
override fun removeFile(

0 commit comments

Comments
 (0)