From 580d757be2d289d95f3916688c2bb44cfed0e038 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 1 Feb 2023 22:28:17 +0600 Subject: [PATCH] fixes in download file and upgrade ktor version --- gradle/libs.versions.toml | 2 +- .../dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1f43dec4c89..51869c69f1c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jb-dokka = "1.7.20" klock = "3.4.0" uuid = "0.6.0" -ktor = "2.2.2" +ktor = "2.2.3" gh-release = "2.4.1" diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt index 2056a6e704b..998fef99797 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt @@ -10,8 +10,8 @@ import java.io.File fun PartData.FileItem.download(target: File) { provider().use { input -> - target.outputStream().use { - input.copyTo(it.asOutput()) + target.outputStream().asOutput().use { + input.copyTo(it) } } }