Skip to content

Commit c558276

Browse files
authored
fix: use new getUploadFileMaxSize function added to constants
This change allows the ModalDropzone to fetch the maximum allowed size via a call to getUploadFileMaxSize() defined in constants. Additionally fixes the conversion factor (maxSize/(1024*1024) vs (1000*1000) for consistency with upstream code
1 parent ad1bd86 commit c558276

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/generic/modal-dropzone/ModalDropzone.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
} from '@openedx/paragon';
1414
import { FileUpload as FileUploadIcon } from '@openedx/paragon/icons';
1515

16+
import { getUploadFileMaxSize } from '@src/constants';
1617
import useModalDropzone from './useModalDropzone';
1718
import messages from './messages';
18-
import { UPLOAD_FILE_MAX_SIZE } from '../../constants';
1919

2020
const ModalDropzone = ({
2121
fileTypes,
@@ -30,7 +30,7 @@ const ModalDropzone = ({
3030
onChange,
3131
onSavingStatus,
3232
onSelectFile,
33-
maxSize = UPLOAD_FILE_MAX_SIZE,
33+
maxSize,
3434
}) => {
3535
const {
3636
intl,
@@ -48,7 +48,7 @@ const ModalDropzone = ({
4848

4949
const invalidSizeMore = invalidFileSizeMore || intl.formatMessage(
5050
messages.uploadImageDropzoneInvalidSizeMore,
51-
{ maxSize: maxSize / (1000 * 1000) },
51+
{ maxSize: (maxSize || getUploadFileMaxSize()) / (1024 * 1024) },
5252
);
5353

5454
const inputComponent = previewUrl ? (
@@ -129,7 +129,7 @@ ModalDropzone.defaultProps = {
129129
imageHelpText: '',
130130
previewComponent: null,
131131
imageDropzoneText: '',
132-
maxSize: UPLOAD_FILE_MAX_SIZE,
132+
maxSize: undefind,
133133
invalidFileSizeMore: '',
134134
onSelectFile: null,
135135
};

0 commit comments

Comments
 (0)