mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Check extension after successful response
This commit is contained in:
parent
926d0a6e92
commit
ed9dfdd76d
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user