This commit is contained in:
tom5079
2020-09-10 22:45:27 +09:00
parent 6e2eeb29cc
commit b53de8624d
7 changed files with 18 additions and 6 deletions

View File

@@ -215,7 +215,7 @@ class DownloadService : Service() {
val ext = call.request().url().encodedPath().split('.').last()
kotlin.runCatching {
val image = response.body()?.use { it.bytes() } ?: throw Exception()
val image = response.also { if (it.code() != 200) throw IOException() }.body()?.use { it.bytes() } ?: throw Exception()
CoroutineScope(Dispatchers.IO).launch {
kotlin.runCatching {