You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
use Authorization header in media/v1/upload if enabled, instead of query
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -271,9 +271,18 @@ module.exports.MatrixHttpApi.prototype = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let url = this.opts.baseUrl + "/_matrix/media/v1/upload";
|
let url = this.opts.baseUrl + "/_matrix/media/v1/upload?";
|
||||||
url += "?access_token=" + encodeURIComponent(this.opts.accessToken);
|
|
||||||
url += "&filename=" + encodeURIComponent(fileName);
|
const queryArgs = ["filename=" + encodeURIComponent(fileName)];
|
||||||
|
|
||||||
|
if (this.useAuthorizationHeader) {
|
||||||
|
xhr.setRequestHeader("Authorization", "Bearer " + this.opts.accessToken);
|
||||||
|
} else {
|
||||||
|
queryArgs.push("access_token="
|
||||||
|
+ encodeURIComponent(this.opts.accessToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
url += queryArgs.join("&");
|
||||||
|
|
||||||
xhr.open("POST", url);
|
xhr.open("POST", url);
|
||||||
xhr.setRequestHeader("Content-Type", contentType);
|
xhr.setRequestHeader("Content-Type", contentType);
|
||||||
|
|||||||
Reference in New Issue
Block a user