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(RHINENG-15180): Fix CSV data export with unicode chars #2178

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

kruai
Copy link
Collaborator

@kruai kruai commented Jan 13, 2025

Overview

This PR is being created to address RHINENG-15180.
Encodes export_service's POST requests in utf-8 and sets the charset header accordingly. Also makes a try/catch more specific so we can more easily detect this kind of error in the future - it used to just broadly catch all Exceptions and handle them the same way, so the UnicodeEncodeError went undetected.

PR Checklist

  • Keep PR title short, ideally under 72 characters
  • Descriptive comments provided in complex code blocks
  • Include raw query examples in the PR description, if adding/modifying SQL query
  • Tests: validate optimal/expected output
  • Tests: validate exceptions and failure scenarios
  • Tests: edge cases
  • Recovers or fails gracefully during potential resource outages (e.g. DB, Kafka)
  • Uses type hinting, if convenient
  • Documentation, if this PR changes the way other services interact with host inventory
  • Links to related PRs

Secure Coding Practices Documentation Reference

You can find documentation on this checklist here.

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

@kruai kruai requested a review from a team as a code owner January 13, 2025 15:41
chambridge
chambridge previously approved these changes Jan 14, 2025
Copy link
Contributor

@chambridge chambridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kruai
Copy link
Collaborator Author

kruai commented Jan 15, 2025

/retest

1 similar comment
@kruai
Copy link
Collaborator Author

kruai commented Jan 15, 2025

/retest

@fstavela fstavela force-pushed the csv-quote-exception branch from b91b1ff to 4faa29b Compare January 17, 2025 08:56
@fstavela
Copy link
Contributor

/retest

@kruai kruai merged commit 0621d61 into master Jan 17, 2025
13 of 16 checks passed
@kruai kruai deleted the csv-quote-exception branch January 17, 2025 22:05
thearifismail pushed a commit to thearifismail/insights-host-inventory that referenced this pull request Jan 21, 2025
…ights#2178)

* Encode export_service POSTs in utf-8; make try/catch more specific; test

* Add type hint

* Update test_handle_create_export_unicode

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

---------

Co-authored-by: Frantisek Stavela <[email protected]>
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.

3 participants