Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Clean control chars from issue body field (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentS committed Nov 10, 2021
1 parent ccf702e commit f17152d
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit f17152d

Please sign in to comment.