PLT-1316/PLT-3280 Change client-side max file size limit (#3354)
* Change client-side max file size limit It now relies on the value set in config.json. Re-enable and tweak the max file size setting in system console. * Update file upload error message
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
71bd413b25
Коммит
f4dd8e5796
@@ -44,6 +44,7 @@ class FileUpload extends React.Component {
|
||||
this.keyUpload = this.keyUpload.bind(this);
|
||||
|
||||
this.state = {
|
||||
maxFileSize: global.window.mm_config.MaxFileSize,
|
||||
requests: {}
|
||||
};
|
||||
}
|
||||
@@ -75,7 +76,7 @@ class FileUpload extends React.Component {
|
||||
const tooLargeFiles = [];
|
||||
|
||||
for (let i = 0; i < files.length && numUploads < uploadsRemaining; i++) {
|
||||
if (files[i].size > Constants.MAX_FILE_SIZE) {
|
||||
if (files[i].size > this.state.maxFileSize) {
|
||||
tooLargeFiles.push(files[i]);
|
||||
continue;
|
||||
}
|
||||
@@ -106,9 +107,9 @@ class FileUpload extends React.Component {
|
||||
} else if (tooLargeFiles.length > 1) {
|
||||
var tooLargeFilenames = tooLargeFiles.map((file) => file.name).join(', ');
|
||||
|
||||
this.props.onUploadError(formatMessage(holders.filesAbove, {max: (Constants.MAX_FILE_SIZE / 1000000), filenames: tooLargeFilenames}));
|
||||
this.props.onUploadError(formatMessage(holders.filesAbove, {max: (this.state.maxFileSize / 1048576), filenames: tooLargeFilenames}));
|
||||
} else if (tooLargeFiles.length > 0) {
|
||||
this.props.onUploadError(formatMessage(holders.fileAbove, {max: (Constants.MAX_FILE_SIZE / 1000000), filename: tooLargeFiles[0].name}));
|
||||
this.props.onUploadError(formatMessage(holders.fileAbove, {max: (this.state.maxFileSize / 1048576), filename: tooLargeFiles[0].name}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user