mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-14 20:30:12 +08:00
Fail-fast inputSize
checking
This commit is contained in:
parent
0d08956349
commit
49f2329112
@ -79,7 +79,7 @@ class ExternalImage private constructor(
|
|||||||
) : this(width, height, md5, imageFormat, input as Any, input.available().toLong(), filename)
|
) : this(width, height, md5, imageFormat, input as Any, input.available().toLong(), filename)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(inputSize in 0L..Int.MAX_VALUE.toLong()) { "file is too big" }
|
require(inputSize < 30L * 1024 * 1024) { "file is too big. Maximum is about 20MB" }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
Loading…
Reference in New Issue
Block a user