Skip to content

Commit

Permalink
Merge pull request #1485 from nextcloud/nextcloudUri
Browse files Browse the repository at this point in the history
base url shall never be null
  • Loading branch information
tobiasKaminsky authored Nov 20, 2024
2 parents 2a68af4 + 76a860b commit 0800cec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0800cec

Please sign in to comment.