mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
Merge pull request #2025 from 821938089/fix-webdav
修复webDav的exists函数对文件夹始终返回false的bug
This commit is contained in:
@@ -171,7 +171,13 @@ open class WebDav(val path: String, val authorization: Authorization) {
|
||||
* 文件是否存在
|
||||
*/
|
||||
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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user