mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
UrlUtil.getFileName先尝试截取
This commit is contained in:
@@ -450,7 +450,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
||||
}
|
||||
|
||||
// 后缀
|
||||
val suffix: String = name.substringAfterLast(".")
|
||||
val suffix: String = UrlUtil.getSuffix(name)
|
||||
|
||||
// txt epub umd pdf等文件
|
||||
val isSupported: Boolean = AppPattern.bookFileRegex.matches(name)
|
||||
|
||||
@@ -44,7 +44,7 @@ object UrlUtil {
|
||||
// 如果获取到后缀可直接截取链接
|
||||
if (getSuffix(fileUrl, "") != "") return fileUrl.substringAfterLast("/")
|
||||
return kotlin.runCatching {
|
||||
var fileName: String
|
||||
var fileName: String = ""
|
||||
val url = URL(fileUrl)
|
||||
val conn: HttpURLConnection = url.openConnection() as HttpURLConnection
|
||||
// HEAD方式获取返回头信息
|
||||
|
||||
Reference in New Issue
Block a user