From 76a860b0138ad248793f1e84c1ae01019d096983 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 25 Jun 2024 09:31:43 +0200 Subject: [PATCH] base url shall never be null Signed-off-by: tobiasKaminsky --- .../java/com/nextcloud/common/NextcloudUriDelegate.kt | 11 +---------- .../java/com/nextcloud/common/NextcloudUriProvider.kt | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/library/src/main/java/com/nextcloud/common/NextcloudUriDelegate.kt b/library/src/main/java/com/nextcloud/common/NextcloudUriDelegate.kt index c93b8e803..c6b58973d 100644 --- a/library/src/main/java/com/nextcloud/common/NextcloudUriDelegate.kt +++ b/library/src/main/java/com/nextcloud/common/NextcloudUriDelegate.kt @@ -18,21 +18,12 @@ import com.owncloud.android.lib.common.network.WebdavUtils * When finally getting rid of [com.owncloud.android.lib.common.OwnCloudClient], * this should be separate from the client. */ -class NextcloudUriDelegate(baseUri: Uri, var userId: String?) : NextcloudUriProvider { +class NextcloudUriDelegate(override var baseUri: Uri, var userId: String?) : NextcloudUriProvider { constructor(baseUri: Uri) : this(baseUri, null) val userIdEncoded: String? get() = userId?.let { UserIdEncoder.encode(it) } - /** - * Root URI of the Nextcloud server - */ - override var baseUri: Uri? = baseUri - set(uri) { - requireNotNull(uri) { "URI cannot be NULL" } - field = uri - } - override val filesDavUri: Uri get() = Uri.parse("$davUri/files/$userIdEncoded") override val uploadUri: Uri diff --git a/library/src/main/java/com/nextcloud/common/NextcloudUriProvider.kt b/library/src/main/java/com/nextcloud/common/NextcloudUriProvider.kt index 30adcb535..31ef4a9aa 100644 --- a/library/src/main/java/com/nextcloud/common/NextcloudUriProvider.kt +++ b/library/src/main/java/com/nextcloud/common/NextcloudUriProvider.kt @@ -13,7 +13,7 @@ interface NextcloudUriProvider { /** * Root URI of the Nextcloud server */ - var baseUri: Uri? + var baseUri: Uri val filesDavUri: Uri val uploadUri: Uri val davUri: Uri