Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
use Uri.parse instead of Java's URLEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
seldon1000 committed Jul 16, 2021
1 parent 460ce63 commit b2a076d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ import io.ktor.client.features.auth.providers.*
import io.ktor.client.features.json.*
import io.ktor.client.features.json.serializer.*
import io.ktor.client.request.*
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.serializer
import java.net.URLEncoder

@SuppressLint("StaticFieldLeak")
object NextcloudApiProvider : ViewModel() {
Expand Down Expand Up @@ -188,8 +190,7 @@ object NextcloudApiProvider : ViewModel() {
try {
val response = client.post<JsonObject>(urlString = url.value)

val login =
URLEncoder.encode(response["login"]!!.jsonPrimitive.content, "UTF-8")
val login = Uri.encode(response["login"]!!.jsonPrimitive.content, "UTF-8")
val endpoint = response["poll"]!!.jsonObject["endpoint"]!!.jsonPrimitive.content
val token = response["poll"]!!.jsonObject["token"]!!.jsonPrimitive.content

Expand Down

0 comments on commit b2a076d

Please sign in to comment.