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

Improve error messaging around invalid characters in import #12489

Merged
merged 4 commits into from
Feb 8, 2023

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR improves the error messaging around characters that cannot be encoded during the beginning of the import process.

Currently, if an import contains a character that cannot be encoded to JSON in the header or first content rows the status bar turns red but the user is not given a message telling them what went wrong:
image

With this PR, a message is shown to the user indicating what happened and pointing them to either the header or content row:
image
image

This also includes returning 422 status codes when the import is in an invalid state instead of 500 and correcting the store method's return type.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This was tested by pasting an invalid 3 octet sequence into a field in the header and first content rows of an import template.
The invalid character I used was: "\xe2\x28\xa1" (â(¡)

@what-the-diff
Copy link

what-the-diff bot commented Feb 8, 2023

  • The file type check was changed from a 500 to 422 error.
  • A new exception handler for malformed UTF-8 characters in the header row and first data row were added, returning a 422 response code instead of an internal server error (500).

@snipe
Copy link
Owner

snipe commented Feb 8, 2023

Awesome, thank you!

@snipe snipe merged commit 35ab4a4 into snipe:develop Feb 8, 2023
@marcusmoore marcusmoore deleted the fix/encoding-errors-in-importer branch February 8, 2023 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants