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 424c0d13c..93fc41c7d 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
@@ -32,7 +32,9 @@ 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
}
@@ -44,7 +46,12 @@ constructor(url: String) {
private val inputStream: InputStream?
get() = getUrl()?.let { url ->
val request = Request.Builder().url(url)
- HttpAuth.auth?.let { request.header("Authorization", Credentials.basic(it.user, it.pass)) }
+ HttpAuth.auth?.let {
+ request.header(
+ "Authorization",
+ Credentials.basic(it.user, it.pass)
+ )
+ }
try {
return okHttpClient.newCall(request.build()).execute().body?.byteStream()
@@ -67,7 +74,6 @@ constructor(url: String) {
} catch (e: UnsupportedEncodingException) {
e.printStackTrace()
}
-
}
return httpUrl
}
@@ -131,7 +137,12 @@ constructor(url: String) {
// 注意:尽量手动指定需要返回的属性。若返回全部属性,可能后由于Prop.java里没有该属性名,而崩溃。
.method("PROPFIND", requestPropsStr.toRequestBody("text/plain".toMediaTypeOrNull()))
- HttpAuth.auth?.let { request.header("Authorization", Credentials.basic(it.user, it.pass)) }
+ HttpAuth.auth?.let {
+ request.header(
+ "Authorization",
+ Credentials.basic(it.user, it.pass)
+ )
+ }
request.header("Depth", if (depth < 0) "infinity" else depth.toString())
@@ -224,7 +235,12 @@ constructor(url: String) {
*/
@Throws(IOException::class)
private fun execRequest(requestBuilder: Request.Builder): Boolean {
- HttpAuth.auth?.let { requestBuilder.header("Authorization", Credentials.basic(it.user, it.pass)) }
+ HttpAuth.auth?.let {
+ requestBuilder.header(
+ "Authorization",
+ Credentials.basic(it.user, it.pass)
+ )
+ }
val response = okHttpClient.newCall(requestBuilder.build()).execute()
return response.isSuccessful
@@ -250,12 +266,12 @@ constructor(url: String) {
val TAG = WebDav::class.java.simpleName
val OBJECT_NOT_EXISTS_TAG = "ObjectNotFound"
// 指定返回哪些属性
- private val DIR = "\n" +
- "\n" +
- "\n" +
- "\n\n\n\n\n%s" +
- "\n" +
- ""
+ private const val DIR = """\n
+ \n
+ \n
+ \n\n\n\n\n%s
+ \n
+ """
/**
* 打印对象内的所有属性