Skip to content

Commit

Permalink
Clean control chars from issue body field (#46)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Boucher <[email protected]>
  • Loading branch information
laurentS and ericboucher authored Nov 10, 2021
1 parent ccf702e commit e650c5b
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 e650c5b

Please sign in to comment.