You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-23 17:02:25 +03:00
invert argument to make it positive without breaking backwards compat
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -1071,9 +1071,9 @@ MatrixBaseApis.prototype.searchUserDirectory = function(opts) {
|
|||||||
* @param {string=} opts.name Name to give the file on the server. Defaults
|
* @param {string=} opts.name Name to give the file on the server. Defaults
|
||||||
* to <tt>file.name</tt>.
|
* to <tt>file.name</tt>.
|
||||||
*
|
*
|
||||||
* @param {boolean=} opts.omitFilename if true will not send the filename,
|
* @param {boolean=} opts.includeFilename if false will not send the filename,
|
||||||
* e.g for encrypted file uploads where filename leaks are undesirable.
|
* e.g for encrypted file uploads where filename leaks are undesirable.
|
||||||
* Defaults to false.
|
* Defaults to true.
|
||||||
*
|
*
|
||||||
* @param {string=} opts.type Content-type for the upload. Defaults to
|
* @param {string=} opts.type Content-type for the upload. Defaults to
|
||||||
* <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.
|
* <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ module.exports.MatrixHttpApi.prototype = {
|
|||||||
* @param {string=} opts.name Name to give the file on the server. Defaults
|
* @param {string=} opts.name Name to give the file on the server. Defaults
|
||||||
* to <tt>file.name</tt>.
|
* to <tt>file.name</tt>.
|
||||||
*
|
*
|
||||||
* @param {boolean=} opts.omitFilename if true will not send the filename,
|
* @param {boolean=} opts.includeFilename if false will not send the filename,
|
||||||
* e.g for encrypted file uploads where filename leaks are undesirable.
|
* e.g for encrypted file uploads where filename leaks are undesirable.
|
||||||
* Defaults to false.
|
* Defaults to true.
|
||||||
*
|
*
|
||||||
* @param {string=} opts.type Content-type for the upload. Defaults to
|
* @param {string=} opts.type Content-type for the upload. Defaults to
|
||||||
* <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.
|
* <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.
|
||||||
@@ -156,6 +156,9 @@ module.exports.MatrixHttpApi.prototype = {
|
|||||||
opts = {};
|
opts = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default opts.includeFilename to true (ignoring falsey values)
|
||||||
|
const includeFilename = opts.includeFilename !== false;
|
||||||
|
|
||||||
// if the file doesn't have a mime type, use a default since
|
// if the file doesn't have a mime type, use a default since
|
||||||
// the HS errors if we don't supply one.
|
// the HS errors if we don't supply one.
|
||||||
const contentType = opts.type || file.type || 'application/octet-stream';
|
const contentType = opts.type || file.type || 'application/octet-stream';
|
||||||
@@ -279,7 +282,7 @@ module.exports.MatrixHttpApi.prototype = {
|
|||||||
|
|
||||||
const queryArgs = [];
|
const queryArgs = [];
|
||||||
|
|
||||||
if (!opts.omitFilename && fileName) {
|
if (includeFilename && fileName) {
|
||||||
queryArgs.push("filename=" + encodeURIComponent(fileName));
|
queryArgs.push("filename=" + encodeURIComponent(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +308,7 @@ module.exports.MatrixHttpApi.prototype = {
|
|||||||
} else {
|
} else {
|
||||||
const queryParams = {};
|
const queryParams = {};
|
||||||
|
|
||||||
if (!opts.omitFilename && fileName) {
|
if (includeFilename && fileName) {
|
||||||
queryParams.filename = fileName;
|
queryParams.filename = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user