Skip to content

Commit 57269ec

Browse files
authored
Update FilesPage.jsx
create an override for the maxFileSize
1 parent c0e3db8 commit 57269ec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/files-and-videos/files-page/FilesPage.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
44
import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
55
import { CheckboxFilter, Container } from '@openedx/paragon';
66
import Placeholder from '../../editors/Placeholder';
7+
import { UPLOAD_FILE_MAX_SIZE } from '../../constants';
78

89
import { RequestStatus } from '../../data/constants';
910
import { useModels, useModel } from '../../generic/model-store';
@@ -90,7 +91,13 @@ const FilesPage = ({
9091
usageErrorMessages: errorMessages.usageMetrics,
9192
fileType: 'file',
9293
};
93-
const maxFileSize = 20 * 1048576;
94+
95+
// MaxFileSize used in Files upload page
96+
// checks if OVERRIDE_UPLOAD_FILE_MAX_SIZE_IN_MB env variable exists and is a valid number, else uses default from constants
97+
const overrideMaxFileSize = parseInt(process.env.OVERRIDE_UPLOAD_FILE_MAX_SIZE_IN_MB, 10);
98+
const maxFileSize = !isNaN(overrideMaxFileSize) && overrideMaxFileSize > 0
99+
? overrideMaxFileSize * 1024 * 1024
100+
: UPLOAD_FILE_MAX_SIZE;
94101

95102
const activeColumn = {
96103
id: 'activeStatus',

0 commit comments

Comments
 (0)