matrix-org / matrix-org/matrix-android-sdk2-sample

received pictures can't be displayed/downloaded

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
26
Forks
12
PR merge metrics
No merged PRs in 30d

Description

I hope you can tell me the correct api to use, to be able to view received images.
Currently i am using:

> viewLifecycleOwner.lifecycleScope.launch {
> try {
> val data = session.fileService().downloadFile(content
> )
> // Switch to Main thread to update UI
> withContext(Dispatchers.Main) {
> Glide.with(imageView.context)
> .load(data)
> .into(imageView)
> }
> } catch (failure: Throwable) {
> Log.e("ImageLoader", "Failed to download image", failure)
> }
> }

with content being 'MessageWithAttachmentContent'.

On the sender device, the image gets shown properly, because this is found in cache.
On the receiver device, it ends up with this:
`09-25 18:55:17.988 22371 22371 V DefaultFileService: ## FileService downloadFile mxc://matrix.org/MgDMGLWWwdrupnxAaIlSBLbX

09-25 18:55:17.991 22371 22416 V FormattedJsonHttpLogger: --> GET https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/MgDMGLWWwdrupnxAaIlSBLbX

09-25 18:55:18.161 22371 22371 V DefaultContentDownloadStateTracker: ## DL Progress Error code:404

09-25 18:55:18.162 22371 22416 V FormattedJsonHttpLogger: <-- 404 Not Found https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/MgDMGLWWwdrupnxAaIlSBLbX (169ms, unknown-length body)

09-25 18:55:18.164 22371 22371 E ImageLoader: Failed to download image`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MessageWithAttachmentContent value and the session.fileService().downloadFile(content) call shown in the report. Trace how received media is downloaded and compare it with the sender-side cache path, focusing on the logged 404 response. Done means a receiver can download and display the attached image using the supported API.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.