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等文件
|
// txt epub umd pdf等文件
|
||||||
val isSupported: Boolean = AppPattern.bookFileRegex.matches(name)
|
val isSupported: Boolean = AppPattern.bookFileRegex.matches(name)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ object UrlUtil {
|
|||||||
// 如果获取到后缀可直接截取链接
|
// 如果获取到后缀可直接截取链接
|
||||||
if (getSuffix(fileUrl, "") != "") return fileUrl.substringAfterLast("/")
|
if (getSuffix(fileUrl, "") != "") return fileUrl.substringAfterLast("/")
|
||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
var fileName: String
|
var fileName: String = ""
|
||||||
val url = URL(fileUrl)
|
val url = URL(fileUrl)
|
||||||
val conn: HttpURLConnection = url.openConnection() as HttpURLConnection
|
val conn: HttpURLConnection = url.openConnection() as HttpURLConnection
|
||||||
// HEAD方式获取返回头信息
|
// HEAD方式获取返回头信息
|
||||||
|
|||||||
Reference in New Issue
Block a user