Skip to content

Update SCM module to handle invalid UTF-8 characters from git output#1492

Open
fuzzyrichie wants to merge 2 commits intodanger:masterfrom
fuzzyrichie:patch-1
Open

Update SCM module to handle invalid UTF-8 characters from git output#1492
fuzzyrichie wants to merge 2 commits intodanger:masterfrom
fuzzyrichie:patch-1

Conversation

@fuzzyrichie
Copy link

In some cases, it seems that Danger will fail if the output contains a single character out of place, failing with "invalid byte sequence in UTF-8 (Encoding::CompatibilityError)" when running rstrip.

In some cases, it seems that Danger will fail if the output contains a single character out of place, failing with "invalid byte sequence in UTF-8 (Encoding::CompatibilityError)" when running rstrip.
@fuzzyrichie fuzzyrichie marked this pull request as ready for review June 21, 2024 18:44
git_command = string.split(" ").dup.unshift("git")
Open3.popen2(default_env, *git_command) do |_stdin, stdout, _wait_thr|
stdout.read.rstrip
stdout.read.scrub.rstrip
Copy link
Member

Choose a reason for hiding this comment

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

@fuzzyrichie Sorry I don't understand what invalid UTF-8 character comes here.

Could you describe minimal steps to reproduce it, and add some test cases?

Copy link
Author

Choose a reason for hiding this comment

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

I'll look to get a sample of the output that caused the error, give me a day or two to set that up!

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.

2 participants