From c53475da37d15271d45604df65f3e3fc67e69021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Garc=C3=ADa=20de=20Prada?= Date: Fri, 10 Mar 2023 12:47:35 +0100 Subject: [PATCH] Removing quotas from webdav properties in regular propfinds --- .../common/http/methods/webdav/DavUtils.kt | 29 +++++++++++++++++-- .../CheckPathExistenceRemoteOperation.kt | 4 +-- .../files/GetBaseUrlRemoteOperation.kt | 2 +- .../files/ReadRemoteFileOperation.kt | 2 +- .../files/ReadRemoteFolderOperation.kt | 2 +- .../android/lib/resources/files/RemoteFile.kt | 11 ------- 6 files changed, 31 insertions(+), 19 deletions(-) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavUtils.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavUtils.kt index a48626d3..ce772609 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavUtils.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavUtils.kt @@ -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 - get() = getAllPropSet().plus(OCShareTypes.NAME) + @JvmStatic val allPropSet: Array + 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 get() = getQuotaPropset() diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CheckPathExistenceRemoteOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CheckPathExistenceRemoteOperation.kt index dd7d0a56..da9b685f 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CheckPathExistenceRemoteOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/CheckPathExistenceRemoteOperation.kt @@ -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) } diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/GetBaseUrlRemoteOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/GetBaseUrlRemoteOperation.kt index 904a9bea..65a8faf9 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/GetBaseUrlRemoteOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/GetBaseUrlRemoteOperation.kt @@ -44,7 +44,7 @@ class GetBaseUrlRemoteOperation : RemoteOperation() { 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) } diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFileOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFileOperation.kt index cf29b60e..787fb751 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFileOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFileOperation.kt @@ -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) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt index 16600fe1..da1dcac6 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt @@ -64,7 +64,7 @@ class ReadRemoteFolderOperation( val propfindMethod = PropfindMethod( getFinalWebDavUrl(), DavConstants.DEPTH_1, - DavUtils.allPropset + DavUtils.allPropSet ) val status = client.executeHttpMethod(propfindMethod) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.kt index 791a0765..16ec6748 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.kt @@ -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 }