aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-08 01:46:30 -0700
committerAllan Wang <me@allanwang.ca>2019-09-08 01:46:30 -0700
commited9dfdd76d90d1f9a4fd52d5f90ad790f671a776 (patch)
tree9814e7f3f6ad1fe1261a51d0f0f0a4cfc7a2cede /app/src/main
parent926d0a6e9219852c48f15b526493267a855517e2 (diff)
downloadfrost-ed9dfdd76d90d1f9a4fd52d5f90ad790f671a776.tar.gz
frost-ed9dfdd76d90d1f9a4fd52d5f90ad790f671a776.tar.bz2
frost-ed9dfdd76d90d1f9a4fd52d5f90ad790f671a776.zip
Check extension after successful response
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
index 15efc527..09620a54 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -362,12 +362,12 @@ class ImageActivity : KauBaseActivity() {
.call()
.execute()
- imgExtension = getImageExtension(response.header("Content-Type")) ?: ".jpg"
-
if (!response.isSuccessful) {
throw IOException("Unsuccessful response for image: ${response.peekBody(128).string()}")
}
+ imgExtension = getImageExtension(response.header("Content-Type")) ?: ".jpg"
+
val body = response.body() ?: throw IOException("Failed to retrieve image body")
file.copyFromInputStream(body.byteStream())