|
|
@ -190,12 +190,13 @@ class WebDav(urlStr: String) { |
|
|
|
val url = httpUrl |
|
|
|
val url = httpUrl |
|
|
|
val auth = HttpAuth.auth |
|
|
|
val auth = HttpAuth.auth |
|
|
|
if (url != null && auth != null) { |
|
|
|
if (url != null && auth != null) { |
|
|
|
okHttpClient.newCall { |
|
|
|
return kotlin.runCatching { |
|
|
|
url(url) |
|
|
|
okHttpClient.newCall { |
|
|
|
put(fileBody) |
|
|
|
url(url) |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
put(fileBody) |
|
|
|
}.close() |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
return true |
|
|
|
}.close() |
|
|
|
|
|
|
|
}.isSuccess |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
@ -206,12 +207,13 @@ class WebDav(urlStr: String) { |
|
|
|
val url = httpUrl |
|
|
|
val url = httpUrl |
|
|
|
val auth = HttpAuth.auth |
|
|
|
val auth = HttpAuth.auth |
|
|
|
if (url != null && auth != null) { |
|
|
|
if (url != null && auth != null) { |
|
|
|
okHttpClient.newCall { |
|
|
|
return kotlin.runCatching { |
|
|
|
url(url) |
|
|
|
okHttpClient.newCall { |
|
|
|
put(fileBody) |
|
|
|
url(url) |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
put(fileBody) |
|
|
|
}.close() |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
return true |
|
|
|
}.close() |
|
|
|
|
|
|
|
}.isSuccess |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
@ -220,10 +222,12 @@ class WebDav(urlStr: String) { |
|
|
|
val url = httpUrl |
|
|
|
val url = httpUrl |
|
|
|
val auth = HttpAuth.auth |
|
|
|
val auth = HttpAuth.auth |
|
|
|
if (url != null && auth != null) { |
|
|
|
if (url != null && auth != null) { |
|
|
|
return okHttpClient.newCall { |
|
|
|
return kotlin.runCatching { |
|
|
|
url(url) |
|
|
|
okHttpClient.newCall { |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
url(url) |
|
|
|
}.byteStream() |
|
|
|
addHeader("Authorization", Credentials.basic(auth.user, auth.pass)) |
|
|
|
|
|
|
|
}.byteStream() |
|
|
|
|
|
|
|
}.getOrNull() |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|