Conversation
…internal server error or other error status codes AtlasOfLivingAustralia/fieldcapture#3711
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the file-upload scanning flow so the interceptor can distinguish between “virus detected” (422) and “scan failure” (500), and surfaces those messages in the Knockout file upload UI.
Changes:
- Change
ScanService.isDocumentCleanto return the scan HTTP status code (instead of a boolean). - Update
FileScanInterceptorto reject uploads on 422, allow on all-200, and fail with 500 for other scan outcomes. - Update client-side upload failure handling to display server messages for both 422 and 500.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/test/groovy/au/org/ala/merit/FileScanInterceptorSpec.groovy |
Adjusts mocking setup and adds a new test for scan failure handling (500). |
grails-app/services/au/org/ala/ecodata/forms/ScanService.groovy |
Returns scan HTTP status codes to enable richer interceptor decisions. |
grails-app/controllers/au/org/ala/merit/FileScanInterceptor.groovy |
Implements 422 vs 500 behavior based on scan status codes. |
grails-app/assets/javascripts/forms-knockout-bindings.js |
Displays server-provided error messages for both 422 and 500 upload failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
grails-app/services/au/org/ala/ecodata/forms/ScanService.groovy
Outdated
Show resolved
Hide resolved
grails-app/controllers/au/org/ala/merit/FileScanInterceptor.groovy
Outdated
Show resolved
Hide resolved
Comment on lines
+92
to
+94
| request.getFileNames() >> ['clean.txt', 'corrupt.txt'].iterator() | ||
| request.addFile(cleanFile) | ||
| request.addFile(corruptFile) |
| } | ||
|
|
||
| then: | ||
| 2 * scanService.ecpWebService.postMultipart(*_) >> [statusCode: HttpStatus.INTERNAL_SERVER_ERROR.value()] |
chrisala
approved these changes
Mar 15, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…fLivingAustralia/ecodata-client-plugin into feature/3711-fieldcapture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.