浏览代码

Fail-fast `inputSize` checking

Him188 6 年之前
父节点
当前提交
49f2329112
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt

+ 1 - 1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt

@@ -79,7 +79,7 @@ class ExternalImage private constructor(
     ) : this(width, height, md5, imageFormat, input as Any, input.available().toLong(), filename)
 
     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 {