mirror of
https://github.com/owncloud/android-library.git
synced 2025-07-10 16:08:49 +00:00
Adapt the propfind to work with specific webdavurl from the space
This commit is contained in:
parent
7799b77600
commit
b1286fb92a
@ -48,7 +48,8 @@ import java.net.URL
|
||||
* @author David González Verdugo
|
||||
*/
|
||||
class ReadRemoteFolderOperation(
|
||||
val remotePath: String
|
||||
val remotePath: String,
|
||||
val spaceWebDavUrl: String? = null,
|
||||
) : RemoteOperation<ArrayList<RemoteFile>>() {
|
||||
|
||||
/**
|
||||
@ -61,7 +62,7 @@ class ReadRemoteFolderOperation(
|
||||
PropertyRegistry.register(OCShareTypes.Factory())
|
||||
|
||||
val propfindMethod = PropfindMethod(
|
||||
URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(remotePath)),
|
||||
getFinalWebDavUrl(),
|
||||
DavConstants.DEPTH_1,
|
||||
DavUtils.allPropset
|
||||
)
|
||||
@ -107,5 +108,11 @@ class ReadRemoteFolderOperation(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFinalWebDavUrl(): URL {
|
||||
val baseWebDavUrl = spaceWebDavUrl ?: client.userFilesWebDavUri.toString()
|
||||
|
||||
return URL(baseWebDavUrl + WebdavUtils.encodePath(remotePath))
|
||||
}
|
||||
|
||||
private fun isSuccess(status: Int): Boolean = status.isOneOf(HTTP_OK, HTTP_MULTI_STATUS)
|
||||
}
|
||||
|
@ -61,7 +61,8 @@ interface FileService : Service {
|
||||
): RemoteOperationResult<RemoteFile>
|
||||
|
||||
fun refreshFolder(
|
||||
remotePath: String
|
||||
remotePath: String,
|
||||
spaceWebDavUrl: String? = null,
|
||||
): RemoteOperationResult<ArrayList<RemoteFile>>
|
||||
|
||||
fun removeFile(
|
||||
|
@ -98,10 +98,12 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
|
||||
).execute(client)
|
||||
|
||||
override fun refreshFolder(
|
||||
remotePath: String
|
||||
remotePath: String,
|
||||
spaceWebDavUrl: String?,
|
||||
): RemoteOperationResult<ArrayList<RemoteFile>> =
|
||||
ReadRemoteFolderOperation(
|
||||
remotePath = remotePath
|
||||
remotePath = remotePath,
|
||||
spaceWebDavUrl = spaceWebDavUrl,
|
||||
).execute(client)
|
||||
|
||||
override fun removeFile(
|
||||
|
Loading…
x
Reference in New Issue
Block a user