This commit is contained in:
Will Hunt 2018-05-03 16:37:25 +01:00
parent c99f5c0df8
commit 0fad90eb43

View file

@ -101,13 +101,15 @@ export default class MessageComposer extends React.Component {
const tfiles = files.target.files; const tfiles = files.target.files;
MatrixClientPeg.get().getMediaLimits().then((limits) => { MatrixClientPeg.get().getMediaLimits().then((limits) => {
this.uploadFiles(tfiles, limits); this.uploadFiles(tfiles, limits);
}).catch(() => {
// HS can't or won't provide limits, so don't give any.
this.uploadFiles(tfiles, {});
}); });
} }
isFileUploadAllowed(file, limits) { isFileUploadAllowed(file, limits) {
const sizeLimit = limits.size || -1; if (limits.size != null && file.size > limits.size) {
if (sizeLimit !== -1 && file.size > sizeLimit) { return _t("File is too big. Maximum file size is %(fileSize)s", {fileSize: filesize(limits.size)});
return _t("File is too big. Maximum file size is %(fileSize)s", {fileSize: filesize(sizeLimit)});
} }
return true; return true;
} }