From 71c95a37fb016f18a40a6e84b7c505fc527895ca Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 23 Sep 2019 11:40:04 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/lib/webdav/WebDav.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt index 29229bbbb..d7aa3c137 100644 --- a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt +++ b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt @@ -20,9 +20,9 @@ import java.net.URLEncoder import java.util.* class WebDav @Throws(MalformedURLException::class) -constructor(url: String) { +constructor(urlStr: String) { private val okHttpClient = HttpHelper.client - private val url: URL = URL(null, url, Handler) + private val url: URL = URL(null, urlStr, Handler) private var httpUrl: String? = null var displayName: String? = null @@ -32,9 +32,10 @@ constructor(url: String) { var urlName = "" get() { if (field.isEmpty()) { - this.urlName = (if (parent.isEmpty()) url.file else url.toString() - .replace(parent, "")) - .replace("/", "") + this.urlName = ( + if (parent.isEmpty()) url.file + else url.toString().replace(parent, "") + ).replace("/", "") } return field } @@ -140,9 +141,7 @@ constructor(url: String) { Credentials.basic(it.user, it.pass) ) } - request.header("Depth", if (depth < 0) "infinity" else depth.toString()) - return okHttpClient.newCall(request.build()).execute() } return null @@ -238,7 +237,6 @@ constructor(url: String) { Credentials.basic(it.user, it.pass) ) } - val response = okHttpClient.newCall(requestBuilder.build()).execute() return response.isSuccessful }