Skip to content

Commit 6b60d91

Browse files
authored
fix: use new getUploadFileMaxSize function added to constants
This change allows the TextbookForm 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 c558276 commit 6b60d91

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/textbooks/textbook-form/TextbookForm.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import {
1717
useToggle,
1818
} from '@openedx/paragon';
1919

20+
import { getUploadFileMaxSize } from '@src/constants';
2021
import FormikControl from '../../generic/FormikControl';
2122
import PromptIfDirty from '../../generic/prompt-if-dirty/PromptIfDirty';
2223
import ModalDropzone from '../../generic/modal-dropzone/ModalDropzone';
2324
import { useModel } from '../../generic/model-store';
24-
import { UPLOAD_FILE_MAX_SIZE } from '../../constants';
2525
import textbookFormValidationSchema from './validations';
2626
import messages from './messages';
2727

@@ -171,7 +171,7 @@ const TextbookForm = ({
171171
onSavingStatus={onSavingStatus}
172172
invalidFileSizeMore={intl.formatMessage(
173173
messages.uploadModalFileInvalidSizeText,
174-
{ maxSize: UPLOAD_FILE_MAX_SIZE / (1000 * 1000) },
174+
{ maxSize: getUploadFileMaxSize() / (1024 * 1024) },
175175
)}
176176
onSelectFile={setSelectedFile}
177177
previewComponent={(
@@ -180,7 +180,7 @@ const TextbookForm = ({
180180
<span className="modal-preview-text">{selectedFile}</span>
181181
</div>
182182
)}
183-
maxSize={UPLOAD_FILE_MAX_SIZE}
183+
maxSize={getUploadFileMaxSize()}
184184
/>
185185
<PromptIfDirty dirty={dirty} />
186186
</>

0 commit comments

Comments
 (0)