Merge pull request #1230 from vector-im/feature/fix_download_file
Catch network errors during file downloading.
This commit is contained in:
commit
dcfbfc4981
|
@ -28,6 +28,7 @@ Bugfix 🐛:
|
|||
- Cross- Signing | After signin in new session, verification paper trail in DM is off (#1191)
|
||||
- Failed to encrypt message in room (message stays in red), [thanks to pwr22] (#925)
|
||||
- Cross-Signing | web <-> riotX After QR code scan, gossiping fails (#1210)
|
||||
- Fix crash when trying to download file without internet connection (#1229)
|
||||
- Local echo are not updated in timeline (for failed & encrypted states)
|
||||
|
||||
Translations 🗣:
|
||||
|
|
|
@ -79,9 +79,15 @@ internal class DefaultFileService @Inject constructor(
|
|||
.url(resolvedUrl)
|
||||
.build()
|
||||
|
||||
val response = okHttpClient.newCall(request).execute()
|
||||
val response = try {
|
||||
okHttpClient.newCall(request).execute()
|
||||
} catch (e: Throwable) {
|
||||
return@flatMap Try.Failure(e)
|
||||
}
|
||||
|
||||
var inputStream = response.body?.byteStream()
|
||||
Timber.v("Response size ${response.body?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||
|
||||
if (!response.isSuccessful || inputStream == null) {
|
||||
return@flatMap Try.Failure(IOException())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue