mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +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
|
var newImageAttributes: NewImageAttributes? = null
|
||||||
|
|
||||||
try {
|
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 {
|
inputStream.use {
|
||||||
var uploadedThumbnailUrl: String? = null
|
var uploadedThumbnailUrl: String? = null
|
||||||
|
@ -122,8 +129,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
||||||
|
|
||||||
uploadedThumbnailUrl = contentUploadResponse.contentUri
|
uploadedThumbnailUrl = contentUploadResponse.contentUri
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
Timber.e(t)
|
Timber.e(t, "Thumbnail update failed")
|
||||||
return handleFailure(params, t)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue