pull/2025/head
821938089 2 years ago
parent a48cffbba5
commit 17a8b4f1ff
  1. 7
      app/src/main/java/io/legado/app/lib/webdav/WebDav.kt

@ -172,14 +172,11 @@ open class WebDav(val path: String, val authorization: Authorization) {
*/
suspend fun exists(): Boolean {
return kotlin.runCatching {
val requestPropsStr = DIR.replace("%s", "")
return okHttpClient.newCallResponse {
url(url)
addHeader(authorization.name, authorization.data)
addHeader("Depth", "0")
val requestBody = requestPropsStr.toRequestBody("application/xml".toMediaType())
method("PROPFIND", requestBody)
}.code == 207
head()
}.code == 200
}.getOrDefault(false)
}

Loading…
Cancel
Save