1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-14 10:47:30 +00:00

fix download extension parsing

This commit is contained in:
Austin Huang 2021-07-05 14:16:29 -04:00
parent 506e0c5685
commit 06f679608c
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -209,9 +209,7 @@ object DownloadUtils {
val extension = getFileExtensionFromUrl(displayUrl) val extension = getFileExtensionFromUrl(displayUrl)
val usernamePrepend = if (isEmpty(username)) "" else username + "_" val usernamePrepend = if (isEmpty(username)) "" else username + "_"
val fileName = usernamePrepend + postId + sliderPostfix + extension val fileName = usernamePrepend + postId + sliderPostfix + extension
val mimeType = Utils.mimeTypeMap.getMimeTypeFromExtension( val mimeType = Utils.mimeTypeMap.getMimeTypeFromExtension(extension)
if (extension.startsWith(".")) extension.substring(1) else extension
)
return Pair(fileName, mimeType!!) return Pair(fileName, mimeType!!)
} }
@ -269,7 +267,7 @@ object DownloadUtils {
) { ) {
val dotPos = filename.lastIndexOf('.') val dotPos = filename.lastIndexOf('.')
if (0 <= dotPos) { if (0 <= dotPos) {
return filename.substring(dotPos) return filename.substring(dotPos + 1)
} }
} }
} }