Merge pull request #2025 from 821938089/fix-webdav

修复webDav的exists函数对文件夹始终返回false的bug
pull/2037/head
kunfei 2 years ago committed by GitHub
commit e2baf72032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/io/legado/app/lib/webdav/WebDav.kt

@ -171,7 +171,13 @@ open class WebDav(val path: String, val authorization: Authorization) {
* 文件是否存在 * 文件是否存在
*/ */
suspend fun exists(): Boolean { suspend fun exists(): Boolean {
return getWebDavFile() != null return kotlin.runCatching {
return okHttpClient.newCallResponse {
url(url)
addHeader(authorization.name, authorization.data)
head()
}.code == 200
}.getOrDefault(false)
} }
/** /**

Loading…
Cancel
Save