From 7e63ff363ed8f00651f9f164e90c8049122f5349 Mon Sep 17 00:00:00 2001 From: chanu Date: Sat, 7 Sep 2024 20:35:13 +0900 Subject: [PATCH] =?UTF-8?q?#71=20[hotfix]=20:=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20url=EC=9D=B4=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20http,=20https=20url=EC=9D=B8=EA=B2=BD=EC=9A=B0=20null=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/teamwable/network/util/createImagePart.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/network/src/main/java/com/teamwable/network/util/createImagePart.kt b/core/network/src/main/java/com/teamwable/network/util/createImagePart.kt index 6e3c34b5..ed9805b0 100644 --- a/core/network/src/main/java/com/teamwable/network/util/createImagePart.kt +++ b/core/network/src/main/java/com/teamwable/network/util/createImagePart.kt @@ -7,8 +7,11 @@ import kotlinx.coroutines.withContext import okhttp3.MultipartBody suspend fun ContentResolver.createImagePart(uriString: String?, fileName: String): MultipartBody.Part? { - if (uriString.isNullOrEmpty()) return null - val uri = runCatching { Uri.parse(uriString) }.getOrElse { return null } + val uri = runCatching { Uri.parse(uriString ?: return null) } + .getOrNull() + ?.takeUnless { + it.scheme.equals("http", ignoreCase = true) || it.scheme.equals("https", ignoreCase = true) + } ?: return null return withContext(Dispatchers.IO) { val imageRequestBody = ContentUriRequestBody(this@createImagePart, uri)