fix:缓存图片后缀错误拼接

pull/1770/head
Xwite 3 years ago
parent b8d715419d
commit cb4cd4fd1e
  1. 6
      app/src/main/java/io/legado/app/help/BookHelp.kt

@ -122,7 +122,7 @@ object BookHelp {
cacheFolderName, cacheFolderName,
book.getFolderName(), book.getFolderName(),
cacheImageFolderName, cacheImageFolderName,
"${MD5Utils.md5Encode16(src)}${getImageSuffix(src)}" "${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}"
).writeBytes(it) ).writeBytes(it)
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -137,14 +137,14 @@ object BookHelp {
cacheFolderName, cacheFolderName,
book.getFolderName(), book.getFolderName(),
cacheImageFolderName, cacheImageFolderName,
"${MD5Utils.md5Encode16(src)}${getImageSuffix(src)}" "${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}"
) )
} }
fun getImageSuffix(src: String): String { fun getImageSuffix(src: String): String {
var suffix = src.substringAfterLast(".").substringBefore(",") var suffix = src.substringAfterLast(".").substringBefore(",")
if (suffix.length > 5) { if (suffix.length > 5) {
suffix = ".jpg" suffix = "jpg"
} }
return suffix return suffix
} }

Loading…
Cancel
Save