mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Removing quotas from webdav properties in regular propfinds
This commit is contained in:
		
							parent
							
								
									c2f32b2a82
								
							
						
					
					
						commit
						c53475da37
					
				| @ -24,13 +24,36 @@ | ||||
| package com.owncloud.android.lib.common.http.methods.webdav | ||||
| 
 | ||||
| import at.bitfire.dav4jvm.Property | ||||
| import at.bitfire.dav4jvm.PropertyUtils.getAllPropSet | ||||
| import at.bitfire.dav4jvm.PropertyUtils.getQuotaPropset | ||||
| import at.bitfire.dav4jvm.property.CreationDate | ||||
| import at.bitfire.dav4jvm.property.DisplayName | ||||
| import at.bitfire.dav4jvm.property.GetContentLength | ||||
| import at.bitfire.dav4jvm.property.GetContentType | ||||
| import at.bitfire.dav4jvm.property.GetETag | ||||
| import at.bitfire.dav4jvm.property.GetLastModified | ||||
| import at.bitfire.dav4jvm.property.OCId | ||||
| import at.bitfire.dav4jvm.property.OCPermissions | ||||
| import at.bitfire.dav4jvm.property.OCPrivatelink | ||||
| import at.bitfire.dav4jvm.property.OCSize | ||||
| import at.bitfire.dav4jvm.property.ResourceType | ||||
| import com.owncloud.android.lib.common.http.methods.webdav.properties.OCShareTypes | ||||
| 
 | ||||
| object DavUtils { | ||||
|     @JvmStatic val allPropset: Array<Property.Name> | ||||
|         get() = getAllPropSet().plus(OCShareTypes.NAME) | ||||
|     @JvmStatic val allPropSet: Array<Property.Name> | ||||
|         get() = arrayOf( | ||||
|             DisplayName.NAME, | ||||
|             GetContentType.NAME, | ||||
|             ResourceType.NAME, | ||||
|             GetContentLength.NAME, | ||||
|             GetLastModified.NAME, | ||||
|             CreationDate.NAME, | ||||
|             GetETag.NAME, | ||||
|             OCPermissions.NAME, | ||||
|             OCId.NAME, | ||||
|             OCSize.NAME, | ||||
|             OCPrivatelink.NAME, | ||||
|             OCShareTypes.NAME, | ||||
|         ) | ||||
| 
 | ||||
|     val quotaPropSet: Array<Property.Name> | ||||
|         get() = getQuotaPropset() | ||||
|  | ||||
| @ -25,7 +25,7 @@ package com.owncloud.android.lib.resources.files | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.OwnCloudClient | ||||
| import com.owncloud.android.lib.common.http.HttpConstants | ||||
| import com.owncloud.android.lib.common.http.methods.webdav.DavUtils.allPropset | ||||
| import com.owncloud.android.lib.common.http.methods.webdav.DavUtils.allPropSet | ||||
| import com.owncloud.android.lib.common.http.methods.webdav.PropfindMethod | ||||
| import com.owncloud.android.lib.common.network.WebdavUtils | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperation | ||||
| @ -59,7 +59,7 @@ class CheckPathExistenceRemoteOperation( | ||||
|         val stringUrl = baseStringUrl + WebdavUtils.encodePath(remotePath) | ||||
| 
 | ||||
|         return try { | ||||
|             val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropset).apply { | ||||
|             val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropSet).apply { | ||||
|                 setReadTimeout(TIMEOUT.toLong(), TimeUnit.SECONDS) | ||||
|                 setConnectionTimeout(TIMEOUT.toLong(), TimeUnit.SECONDS) | ||||
|             } | ||||
|  | ||||
| @ -44,7 +44,7 @@ class GetBaseUrlRemoteOperation : RemoteOperation<String?>() { | ||||
|         return try { | ||||
|             val stringUrl = client.baseFilesWebDavUri.toString() | ||||
| 
 | ||||
|             val propFindMethod = PropfindMethod(URL(stringUrl), 0, DavUtils.allPropset).apply { | ||||
|             val propFindMethod = PropfindMethod(URL(stringUrl), 0, DavUtils.allPropSet).apply { | ||||
|                 setReadTimeout(TIMEOUT, TimeUnit.SECONDS) | ||||
|                 setConnectionTimeout(TIMEOUT, TimeUnit.SECONDS) | ||||
|             } | ||||
|  | ||||
| @ -62,7 +62,7 @@ class ReadRemoteFileOperation( | ||||
|             val propFind = PropfindMethod( | ||||
|                 url = getFinalWebDavUrl(), | ||||
|                 depth = DEPTH_0, | ||||
|                 propertiesToRequest = DavUtils.allPropset | ||||
|                 propertiesToRequest = DavUtils.allPropSet | ||||
|             ).apply { | ||||
|                 setReadTimeout(SYNC_READ_TIMEOUT, TimeUnit.SECONDS) | ||||
|                 setConnectionTimeout(SYNC_CONNECTION_TIMEOUT, TimeUnit.SECONDS) | ||||
|  | ||||
| @ -64,7 +64,7 @@ class ReadRemoteFolderOperation( | ||||
|             val propfindMethod = PropfindMethod( | ||||
|                 getFinalWebDavUrl(), | ||||
|                 DavConstants.DEPTH_1, | ||||
|                 DavUtils.allPropset | ||||
|                 DavUtils.allPropSet | ||||
|             ) | ||||
| 
 | ||||
|             val status = client.executeHttpMethod(propfindMethod) | ||||
|  | ||||
| @ -39,8 +39,6 @@ import at.bitfire.dav4jvm.property.OCId | ||||
| import at.bitfire.dav4jvm.property.OCPermissions | ||||
| import at.bitfire.dav4jvm.property.OCPrivatelink | ||||
| import at.bitfire.dav4jvm.property.OCSize | ||||
| import at.bitfire.dav4jvm.property.QuotaAvailableBytes | ||||
| import at.bitfire.dav4jvm.property.QuotaUsedBytes | ||||
| import com.owncloud.android.lib.common.OwnCloudClient | ||||
| import com.owncloud.android.lib.common.http.HttpConstants | ||||
| import com.owncloud.android.lib.common.http.methods.webdav.properties.OCShareTypes | ||||
| @ -51,7 +49,6 @@ import kotlinx.parcelize.Parcelize | ||||
| import okhttp3.HttpUrl | ||||
| import timber.log.Timber | ||||
| import java.io.File | ||||
| import java.math.BigDecimal | ||||
| 
 | ||||
| /** | ||||
|  * Contains the data of a Remote File from a WebDavEntry | ||||
| @ -73,8 +70,6 @@ data class RemoteFile( | ||||
|     var permissions: String? = null, | ||||
|     var remoteId: String? = null, | ||||
|     var size: Long = 0, | ||||
|     var quotaUsedBytes: BigDecimal? = null, | ||||
|     var quotaAvailableBytes: BigDecimal? = null, | ||||
|     var privateLink: String? = null, | ||||
|     var owner: String, | ||||
|     var sharedByLink: Boolean = false, | ||||
| @ -137,12 +132,6 @@ data class RemoteFile( | ||||
|                     is OCSize -> { | ||||
|                         remoteFile.size = property.size | ||||
|                     } | ||||
|                     is QuotaUsedBytes -> { | ||||
|                         remoteFile.quotaUsedBytes = BigDecimal.valueOf(property.quotaUsedBytes) | ||||
|                     } | ||||
|                     is QuotaAvailableBytes -> { | ||||
|                         remoteFile.quotaAvailableBytes = BigDecimal.valueOf(property.quotaAvailableBytes) | ||||
|                     } | ||||
|                     is OCPrivatelink -> { | ||||
|                         remoteFile.privateLink = property.link | ||||
|                     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user