mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user