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