Skip to content

The element web cannot download the files if authentication is enabled. #29920

Closed as duplicate of#28692
@nickolay168

Description

@nickolay168

Steps to reproduce

First of all thank you for the element-web. It is a great way to serve Matrix!
I have found the issue in the element web, preventing file exchange.

  1. Where are you starting? What can you see?
    Setup: The element was installed on ubuntu machine from the deb package and was served as a static page from /var/www/html/element. In the config.json it was pointed to the matrix web server.

  2. What do you click?
    Upload any file to the matrix server. If it will be an image, the preview will not be shown. The download will result in 404 error as follows:
    An error occurred while downloading this file
    DownloadError: MatrixError: [404] Not found (https://matrix.example.com/_matrix/media/v3/download/xxxxx/xxxxxxxxxxxxxxxxxxxxxx?allow_redirect=true)

  3. More steps…
    The problem happens, because the client tries to access files without authorization as it was before implementation of 3916 proposal.
    There is a logic in element-web, which should handle this issue, however, it does not seems to work on web-client side.

I also have confirmed that matrix server can handle the requests properly:

# Results in 404 error
curl -G https://matrix.example.com/_matrix/media/v3/download/xxxxx/xxxxxxxxxxxxxxxxxxxxxx
# Will download encrypted file
curl -H "Authorization: Bearer yyyyyyyyyy" -G https://matrix.example.com/_matrix/media/v3/download/xxxxx/xxxxxxxxxxxxxxxxxxxxxx

It would be great to have the logic adding authenticating the request on the client side.

Outcome

What did you expect?

What happened instead?

Operating system

No response

Browser information

No response

URL for webapp

No response

Application version

No response

Homeserver

No response

Will you send logs?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MediaO-UncommonMost users are unlikely to come across this or unexpected workflowS-MajorSeverely degrades major functionality or product features, with no satisfactory workaroundT-DefectX-Needs-InfoThis issue is blocked awaiting information from the reporter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions