mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Return a failure message if the file cannot be opened.
This commit is contained in:
parent
f68e98b2c7
commit
5cb47dae35
1 changed files with 9 additions and 3 deletions
|
@ -90,7 +90,14 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
|||
var newImageAttributes: NewImageAttributes? = null
|
||||
|
||||
try {
|
||||
val inputStream = context.contentResolver.openInputStream(attachment.queryUri) ?: return Result.success()
|
||||
val inputStream = context.contentResolver.openInputStream(attachment.queryUri)
|
||||
?: return Result.success(
|
||||
WorkerParamsFactory.toData(
|
||||
params.copy(
|
||||
lastFailureMessage = "Cannot openInputStream for file: " + attachment.queryUri.toString()
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
inputStream.use {
|
||||
var uploadedThumbnailUrl: String? = null
|
||||
|
@ -122,8 +129,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
|||
|
||||
uploadedThumbnailUrl = contentUploadResponse.contentUri
|
||||
} catch (t: Throwable) {
|
||||
Timber.e(t)
|
||||
return handleFailure(params, t)
|
||||
Timber.e(t, "Thumbnail update failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue