Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 86b3564

Browse files
authored
Enable redirected media by default (#12142)
* Enable redirected media by default See matrix-org/matrix-js-sdk#4007 * Update the tests * Update tests * Update end-to-end tests too * Update linkifier to use Media customisation endpoint * Fix tests for new js-sdk behaviour * Fix unchanged file * Fix linkifier * Fix lint
1 parent d192807 commit 86b3564

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

playwright/e2e/timeline/timeline.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const expectAvatar = async (cli: Client, e: Locator, avatarUrl: string): Promise
4949
const url = await cli.evaluate(
5050
(client, { avatarUrl, size, resizeMethod }) => {
5151
// eslint-disable-next-line no-restricted-properties
52-
return client.mxcUrlToHttp(avatarUrl, size, size, resizeMethod);
52+
return client.mxcUrlToHttp(avatarUrl, size, size, resizeMethod, false, true);
5353
},
5454
{ avatarUrl, size, resizeMethod: AVATAR_RESIZE_METHOD },
5555
);

src/customisations/Media.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Media {
8080
*/
8181
public get srcHttp(): string | null {
8282
// eslint-disable-next-line no-restricted-properties
83-
return this.client.mxcUrlToHttp(this.srcMxc) || null;
83+
return this.client.mxcUrlToHttp(this.srcMxc, undefined, undefined, undefined, false, true) || null;
8484
}
8585

8686
/**
@@ -90,7 +90,7 @@ export class Media {
9090
public get thumbnailHttp(): string | null {
9191
if (!this.hasThumbnail) return null;
9292
// eslint-disable-next-line no-restricted-properties
93-
return this.client.mxcUrlToHttp(this.thumbnailMxc!);
93+
return this.client.mxcUrlToHttp(this.thumbnailMxc!, undefined, undefined, undefined, false, true);
9494
}
9595

9696
/**
@@ -107,7 +107,7 @@ export class Media {
107107
width = Math.floor(width * window.devicePixelRatio);
108108
height = Math.floor(height * window.devicePixelRatio);
109109
// eslint-disable-next-line no-restricted-properties
110-
return this.client.mxcUrlToHttp(this.thumbnailMxc!, width, height, mode);
110+
return this.client.mxcUrlToHttp(this.thumbnailMxc!, width, height, mode, false, true);
111111
}
112112

113113
/**
@@ -122,7 +122,7 @@ export class Media {
122122
width = Math.floor(width * window.devicePixelRatio);
123123
height = Math.floor(height * window.devicePixelRatio);
124124
// eslint-disable-next-line no-restricted-properties
125-
return this.client.mxcUrlToHttp(this.srcMxc, width, height, mode);
125+
return this.client.mxcUrlToHttp(this.srcMxc, width, height, mode, false, true);
126126
}
127127

128128
/**

src/linkify-matrix.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,15 @@ export const options: Opts = {
184184
switch (type) {
185185
case "url":
186186
if (href.startsWith("mxc://") && MatrixClientPeg.get()) {
187-
return getHttpUriForMxc(MatrixClientPeg.get()!.baseUrl, href);
187+
return getHttpUriForMxc(
188+
MatrixClientPeg.get()!.baseUrl,
189+
href,
190+
undefined,
191+
undefined,
192+
undefined,
193+
false,
194+
true,
195+
);
188196
}
189197
// fallthrough
190198
case Type.RoomAlias:

0 commit comments

Comments
 (0)