Fix image extension "null" received from some official clients

This commit is contained in:
Him188 2021-01-29 11:38:43 +08:00
parent f18aecbbc1
commit df3cc8457d

View File

@ -36,7 +36,12 @@ internal class OnlineGroupImageImpl(
override val imageId: String = generateImageId(
delegate.picMd5,
delegate.filePath.substringAfterLast('.')
delegate.filePath.substringAfterLast('.').toLowerCase().let { ext ->
if (ext == "null") {
// official clients might send `null`
getImageType(delegate.imageType)
} else ext
}
).takeIf {
IMAGE_ID_REGEX.matches(it)
} ?: generateImageId(delegate.picMd5)