Protects against invalid URLs

This commit is contained in:
Vitor Pamplona
2026-03-03 19:30:39 -05:00
parent 5cf306683a
commit 546d1e9e73
@@ -97,15 +97,16 @@ object MediaSaverToDisk {
onSuccess: () -> Any?,
onError: (Throwable) -> Any?,
) {
val client = okHttpClient(url)
val request =
Request
.Builder()
.get()
.url(url)
.build()
try {
val client = okHttpClient(url)
val request =
Request
.Builder()
.get()
.url(url)
.build()
client.newCall(request).executeAsync().use { response ->
withContext(Dispatchers.IO) {
check(response.isSuccessful)