You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Support optional MSC3860 redirects (#4007)
* Support optional MSC3860 redirects See `allow_redirect` across the media endpoints: https://spec.matrix.org/v1.9/client-server-api/#client-behaviour-7 * Update the tests * Appease the linter * Add test to appease SonarCloud * Only add `allow_redirect` if the parameter is specified rather than defaulting to `false` Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@ -37,6 +37,21 @@ describe("ContentRepo", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow redirects when requested on download URLs", function () {
|
||||
const mxcUri = "mxc://server.name/resourceid";
|
||||
expect(getHttpUriForMxc(baseUrl, mxcUri, undefined, undefined, undefined, false, true)).toEqual(
|
||||
baseUrl + "/_matrix/media/v3/download/server.name/resourceid?allow_redirect=true",
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow redirects when requested on thumbnail URLs", function () {
|
||||
const mxcUri = "mxc://server.name/resourceid";
|
||||
expect(getHttpUriForMxc(baseUrl, mxcUri, 32, 32, "scale", false, true)).toEqual(
|
||||
baseUrl +
|
||||
"/_matrix/media/v3/thumbnail/server.name/resourceid?width=32&height=32&method=scale&allow_redirect=true",
|
||||
);
|
||||
});
|
||||
|
||||
it("should return the empty string for null input", function () {
|
||||
expect(getHttpUriForMxc(null as any, "")).toEqual("");
|
||||
});
|
||||
|
Reference in New Issue
Block a user