mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
25d4b489ee
commit
a53a25c23d
@ -149,7 +149,9 @@ object UrlUtil {
|
||||
|
||||
/* 获取合法的文件后缀 */
|
||||
fun getSuffix(str: String, default: String? = null): String {
|
||||
val suffix = CustomUrl(str).getUrl().substringAfterLast(".")
|
||||
val suffix = CustomUrl(str).getUrl()
|
||||
.substringAfterLast(".", "")
|
||||
.substringBefore("?")
|
||||
//检查截取的后缀字符是否合法 [a-zA-Z0-9]
|
||||
val fileSuffixRegex = Regex("^[a-z\\d]+$", RegexOption.IGNORE_CASE)
|
||||
return if (suffix.length > 5 || !suffix.matches(fileSuffixRegex)) {
|
||||
|
Loading…
Reference in New Issue
Block a user