Skip to content
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: missing errors in error mapper #6764

Merged
merged 1 commit into from
Oct 3, 2023
Merged

Conversation

LinHuiqing
Copy link
Contributor

@LinHuiqing LinHuiqing commented Oct 3, 2023

Problem

The errors AttachmentTooLargeError and InvalidFileExtensionError were missing from the error mapper used for storage mode submissions. This caused them to throw 500 unknown route errors. This is an example trace of presenting this issue.

Solution

Breaking Changes

  • No - this PR is backwards compatible

Bug Fixes:

  • AttachmentTooLargeError and InvalidFileExtensionError errors added to error mappers to be treated like other form submission errors where validation fails. There should be a 400 status code returned and an error message asking them to try again. These 2 were the missing error mappings identified from possible errors from src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts > validateStorageSubmission.

Tests

  • Go to a storage mode form with at least 1 attachment field.
  • Open the network panel.
  • Make a submission with at least 1 attachment.
  • Copy the cURL request of the above submission.
  • In a terminal, paste this request and remove the file extensions in both the answer and the file field at the end. This is to simulate an invalid file extension (since there will be no file extensions).
  • Add the -I flag to the cURL request.
  • Enter the request. The status code should be 400 and the message should be "There is something wrong with your form submission. Please check your responses and try again. If the problem persists, please refresh the page."

@LinHuiqing LinHuiqing marked this pull request as ready for review October 3, 2023 08:29
@LinHuiqing LinHuiqing enabled auto-merge (squash) October 3, 2023 15:57
@LinHuiqing LinHuiqing merged commit 1f882da into develop Oct 3, 2023
23 of 24 checks passed
@LinHuiqing LinHuiqing deleted the fix/unknown-route-error branch October 3, 2023 18:00
@LinHuiqing
Copy link
Contributor Author

Linear ticket: FRM-1437

@wanlingt wanlingt mentioned this pull request Oct 4, 2023
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants