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)