mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-11 04:40:10 +08:00
Fix image extension "null" received from some official clients
This commit is contained in:
parent
f18aecbbc1
commit
df3cc8457d
@ -36,7 +36,12 @@ internal class OnlineGroupImageImpl(
|
|||||||
|
|
||||||
override val imageId: String = generateImageId(
|
override val imageId: String = generateImageId(
|
||||||
delegate.picMd5,
|
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 {
|
).takeIf {
|
||||||
IMAGE_ID_REGEX.matches(it)
|
IMAGE_ID_REGEX.matches(it)
|
||||||
} ?: generateImageId(delegate.picMd5)
|
} ?: generateImageId(delegate.picMd5)
|
||||||
|
Loading…
Reference in New Issue
Block a user