-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Validate max file size for attachments #149
Conversation
@@ -118,7 +123,7 @@ function getErrorMessage( | |||
if (!mimeTypeIsValid(file, validFileTypes)) { | |||
return resources.validationFileType; | |||
} else if (!sizeIsValid(file, maxFileSize)) { | |||
return resources.validationFileMax; | |||
return resources.validationFileMax.replace('25', (maxFileSize / 1024 / 1024).toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er ikke helt sikker at det er lurt at gjøre det hit. Er det ikke HN-Skjema sender i riktig format til refero. Kanskje det trenger ikke gjøre noe endring i feilmeldingen
@@ -118,7 +123,7 @@ function getErrorMessage( | |||
if (!mimeTypeIsValid(file, validFileTypes)) { | |||
return resources.validationFileType; | |||
} else if (!sizeIsValid(file, maxFileSize)) { | |||
return resources.validationFileMax; | |||
return resources.validationFileMax.replace('25', (maxFileSize / 1024 / 1024).toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vi har denne i HN-Skjema
skjemaResources.validationFileMax = skjemaResources.validationFileMax.replace(
'{0}',
DEFAULT_MAX_ATTACHMENT_FILE_SIZE_HN_SKJEMA_MB.toString()
);
}); | ||
const question: QuestionnaireItem = { | ||
linkId: '4c71df6e-d743-46ba-d81f-f62777ffddb4', | ||
type: 'attachment', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Det er ikke veldig viktig men man kan bruke
import itemType from '../constants/itemType';
type: itemType.ATTATCHMENT
Duplicate of new PR |
Uses questionaire item to set the max file size to validate with Dropzone.
Default is 4MB