add 7th param for authed media

This commit is contained in:
David Langley 2026-04-14 10:49:01 +01:00
parent a084f0234a
commit 39c6cf733d

View File

@ -55,8 +55,9 @@ export class ClientApi implements IClientApi {
public async downloadMxc(mxcUrl: string): Promise<string> {
const client = MatrixClientPeg.safeGet();
// useAuthentication=true produces the authenticated /_matrix/client/v1/media/download URL
const httpUrl = client.mxcUrlToHttp(mxcUrl, undefined, undefined, undefined, false, true);
// useAuthentication=true (7th param) produces /_matrix/client/v1/media/download
// which is required for servers that enforce authenticated media.
const httpUrl = client.mxcUrlToHttp(mxcUrl, undefined, undefined, undefined, false, true, true);
if (!httpUrl) throw new Error(`Cannot resolve mxc URL: ${mxcUrl}`);
const accessToken = client.getAccessToken();
const response = await fetch(httpUrl, {