-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: replace UnicodeDecodeError to prevent large payload logging #4071
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
Conversation
| raise UnprocessableEntityError( | ||
| f"File encoding detection failed: detected '{encoding}' but decode failed. " | ||
| f"File may be corrupted or in an unsupported format." | ||
| ) from None |
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.
why from None
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.
APM would end up capturing the original exception which would contain the full bytes we tried to decode. The None prevents the exception chaining and importantly prevents the bytes from being passed to APM
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.
gotcha thanks!
|
@claude review this? |
|
Claude finished @yuming-long's task —— View job Code Review In Progress
|
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.
LGTM!
Love what you've done here!
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.
🎉

Replace UnicodeDecodeError with UnprocessableEntityError in encoding detection to avoid logging entire file contents. UnicodeDecodeError.object automatically stores complete input data, causing memory issues with large files in logging and error reporting systems.