hotfix for multipart

This commit is contained in:
InsanusMokrassar 2021-12-14 21:13:11 +06:00
parent d97892080b
commit 1ee5b4bfd4

View File

@ -19,6 +19,7 @@ import io.ktor.utils.io.core.Input
import io.ktor.utils.io.core.readBytes import io.ktor.utils.io.core.readBytes
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.serialization.* import kotlinx.serialization.*
import java.io.File
import java.io.File.createTempFile import java.io.File.createTempFile
class UnifiedRouter( class UnifiedRouter(
@ -180,7 +181,9 @@ suspend fun <T> ApplicationCall.uniloadMultipartFile(
resultInput = MPPFile.createTempFile( resultInput = MPPFile.createTempFile(
name.nameWithoutExtension, name.nameWithoutExtension,
".${name.extension}" ".${name.extension}"
) ).apply {
writeBytes(it.provider().readBytes())
}
} }
"data" -> data = standardKtorSerialFormat.decodeDefault(deserializer, it.provider().readBytes()).optional "data" -> data = standardKtorSerialFormat.decodeDefault(deserializer, it.provider().readBytes()).optional
else -> onCustomFileItem(it) else -> onCustomFileItem(it)
@ -212,7 +215,9 @@ suspend fun ApplicationCall.uniloadMultipartFile(
resultInput = MPPFile.createTempFile( resultInput = MPPFile.createTempFile(
name.nameWithoutExtension, name.nameWithoutExtension,
".${name.extension}" ".${name.extension}"
) ).apply {
writeBytes(it.provider().readBytes())
}
} else { } else {
onCustomFileItem(it) onCustomFileItem(it)
} }