-
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
Add file size validation to the Annotations > Add Attachment screen #808
Comments
Hi @GBishop-PHSA, This sounds like it would be a useful feature. Just FYI there's also a Tomcat property that is set when running in the Docker container which may be relevant, the name is |
@joe-crawford Since max size is set in the core app and tomcat, is it not possible to have a configurable value to use for validation by the UI? Should core return its set max to the UI for validation instead? |
At the moment I don't think there are any ApiProperties that are fully dynamic and controlled by the backend, although I don't think there would be a problem with adding one if it's readonly. Alternatively it could be added as a normal configurable ApiProperty but you could use BootStrap.groovy to set the appropriate value on first startup, hopefully there is some way of reading the tomcat configuration value in there as well as the Grails one. I wouldn't have an objection to that but when changing the limit we'd have to remember to change it there as well. |
I like the idea of setting the value for ApiProperty during bootstrap, so that the UI can read it. Is there a current way to set an ApiProperty to be read-only? I wouldn't want an admin to change the value since it wouldn't match the mdm-core/tomcat values. |
👍 Maybe BootStrap.groovy could reset the correct value on every start up. I don't think there's currently a read-only property, to add one you'd have to add a Boolean flag on ApiProperty, and add a SQL migration script to add the corresponding column to the DB. |
@jamesrwelch I've updated mdm-core to validate that an admin has set a max file upload size no greater than the maximum set in the Grails plugin.yml. Bootstrap was update to create an initial value for the api property. |
gh-808 Attachment file size limit validation
Description
When user's add a file attachment, the UI does not validate the size of the file. Our administrators would like the option to limit the file size and provide an error message to the user if a selected file exceeds the limit.
Additional context
Add a configuration feature.attachment_size_limit_mb, where the value is a number representing the file size limit in megabytes.
The user will get an error response from the UI if the limit is exceeded.
The save method of the attachment-list component will include a check for file size. If a file limit config is set and the file exceeds that limit, an error message, "There was a problem saving the attachment. Files cannot be larger than XXmb"
The text was updated successfully, but these errors were encountered: