Skip to content

Commit

Permalink
Merge pull request #93 from kleros/feat/add-check-for-max-file-size
Browse files Browse the repository at this point in the history
feat: add check for max file size
  • Loading branch information
jaybuidl authored Oct 12, 2024
2 parents 8d402d4 + f4372ec commit 64272dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/new-arbitrable-tx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const NewArbitrableTx = ({ formArbitrabletx, accounts, balance, tokens, template
if (values.description.length < 1)
errors.description =
'Description is required.'
if (showFileUpload && values.file.size > 5000000)
errors.file = 'The file is too big. The maximum size is 5MB.'
if (showFileUpload && values.file.size > 1024 * 1024 * 4)
errors.file = 'The file is too big. The maximum size is 4MB.'
for (let extraDetailsKeys of Object.keys(template.optionalInputs)) {
if (!values.extraData[extraDetailsKeys])
errors[extraDetailsKeys] = 'Field required'
Expand Down
4 changes: 2 additions & 2 deletions src/components/new-evidence-arbitrable-tx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const NewEvidenceArbitrableTx = ({ submitEvidence, arbitrable, id }) => (
if (values.description.length > 255)
errors.description =
'The description is too long. The maximum length is 255 characters.'
if (values.file.size > 5000000)
errors.file = 'The file is too big. The maximum size is 5MB.'
if (values.file.size > 1024 * 1024 * 4)
errors.file = 'The file is too big. The maximum size is 4MB.'
return errors
}}
// eslint-disable-next-line react/jsx-no-bind
Expand Down
4 changes: 2 additions & 2 deletions src/components/new-invoice-arbitrable-tx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const NewInvoiceArbitrableTx = ({ formArbitrabletx, accounts }) => {
if (values.description.length > 1000000)
errors.description =
'The description is too long. The maximum length is 1,000,000 characters.'
if (values.file.size > 5000000)
errors.file = 'The file is too big. The maximum size is 5MB.'
if (values.file.size > 1024 * 1024 * 4)
errors.file = 'The file is too big. The maximum size is 4MB.'
return errors
}}
// eslint-disable-next-line react/jsx-no-bind
Expand Down

0 comments on commit 64272dd

Please sign in to comment.