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

Clean control chars from issue body field #46

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tap_github/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ def http_headers(self) -> dict:

def post_process(self, row: dict, context: Optional[dict] = None) -> dict:
row["type"] = "pull_request" if "pull_request" in row else "issue"
if row["body"] is not None:
# some issue bodies include control characters such as \x00
# that some targets (such as postgresql) choke on. This ensures
# such chars are removed from the data before we pass it on to
# the target
row["body"] = row["body"].encode("utf-8", errors="ignore")
return row

schema = th.PropertiesList(
Expand Down