Horis hace 2 años
padre
commit
153fa83c6b

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 local.properties
 .DS_Store
 /build
+build/
 /captures
 .externalNativeBuild
 /release

+ 1 - 1
app/src/main/java/io/legado/app/help/AppWebDav.kt

@@ -73,7 +73,7 @@ object AppWebDav {
                 WebDav(bookProgressUrl, mAuthorization).makeAsDir()
                 WebDav(exportsWebDavUrl, mAuthorization).makeAsDir()
                 WebDav(bgWebDavUrl, mAuthorization).makeAsDir()
-                val rootBooksUrl = "${rootWebDavUrl}books"
+                val rootBooksUrl = "${rootWebDavUrl}books/"
                 defaultBookWebDav = RemoteBookWebDav(rootBooksUrl, mAuthorization)
                 authorization = mAuthorization
             }

+ 4 - 3
app/src/main/java/io/legado/app/lib/webdav/WebDav.kt

@@ -178,13 +178,14 @@ open class WebDav(
             //依然是优化支持 caddy 自建的 WebDav ,其目录后缀都为“/”, 所以删除“/”的判定,不然无法获取该目录项
             val href = element.findNS("href", ns)[0].text().replace("+", "%2B")
             val hrefDecode = URLDecoder.decode(href, "UTF-8")
-                .removeSuffix("/")
-            val fileName = hrefDecode.substringAfterLast("/")
             val webDavFile: WebDav
             try {
                 val urlName = hrefDecode.ifEmpty {
                     url.file.replace("/", "")
                 }
+                val displayName = element
+                    .findNS("displayname", ns)
+                    .firstOrNull()?.text().orEmpty()
                 val contentType = element
                     .findNS("getcontenttype", ns)
                     .firstOrNull()?.text().orEmpty()
@@ -206,7 +207,7 @@ open class WebDav(
                 webDavFile = WebDavFile(
                     fullURL,
                     authorization,
-                    displayName = fileName,
+                    displayName = displayName,
                     urlName = urlName,
                     size = size,
                     contentType = contentType,