Remove redundant checks

This commit is contained in:
Him188 2021-01-01 16:15:55 +08:00
parent 9c6780d5c4
commit b482590ce1

View File

@ -240,10 +240,8 @@ public interface ExternalResource : Closeable {
@JvmStatic
@JvmBlockingBridge
@JvmOverloads
public suspend fun File.uploadAsImage(contact: Contact, formatName: String? = null): Image {
require(this.isFile && this.exists() && this.canRead()) { "file ${this.path} is not readable" }
return toExternalResource(formatName).withUse { uploadAsImage(contact) }
}
public suspend fun File.uploadAsImage(contact: Contact, formatName: String? = null): Image =
toExternalResource(formatName).withUse { uploadAsImage(contact) }
/**