Fixes in uniloadMultipart

This commit is contained in:
InsanusMokrassar 2021-12-27 15:55:05 +06:00
parent d0446850ae
commit e639ae172b
2 changed files with 18 additions and 2 deletions

View File

@ -2,6 +2,10 @@
## 0.8.9
* `Ktor`:
* `Server`:
* Fixes in `uniloadMultipart`
## 0.8.8
* `Versions`:

View File

@ -180,7 +180,13 @@ suspend fun <T> ApplicationCall.uniloadMultipartFile(
"bytes" -> {
val name = FileName(it.originalFileName ?: error("File name is unknown for default part"))
resultInput = MPPFile.createTempFile(
name.nameWithoutExtension,
name.nameWithoutExtension.let {
var resultName = it
while (resultName.length < 3) {
resultName += "_"
}
resultName
},
".${name.extension}"
).apply {
outputStream().use { fileStream ->
@ -216,7 +222,13 @@ suspend fun ApplicationCall.uniloadMultipartFile(
if (it.name == "bytes") {
val name = FileName(it.originalFileName ?: error("File name is unknown for default part"))
resultInput = MPPFile.createTempFile(
name.nameWithoutExtension,
name.nameWithoutExtension.let {
var resultName = it
while (resultName.length < 3) {
resultName += "_"
}
resultName
},
".${name.extension}"
).apply {
outputStream().use { fileStream ->