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: return scan error if exists in parseDiff func #1508

Closed
wants to merge 1 commit into from

Conversation

chasay
Copy link

@chasay chasay commented Feb 22, 2024

Description

When running Bearer with the --diff option and the scanner encounters an error it will return a Error: signal: broken pipe. This is because the error is not checked before returning from the parseDiff function.

Example command: go run ./cmd/bearer/main.go scan ~/code/repo-with-long-line-diff --diff

An example error would be a diff that contains a line longer than the MaxScanTokenSize. (64 * 1024 bytes). With this additional code, the returned error will be Error: bufio.Scanner: token too long.

I'll create a Github issue to accommodate a more thorough fix for handling long lines of diff.

Checklist

  • I've added test coverage that shows my fix or feature works as expected.
  • I've updated or added documentation if required.
  • I've included usage information in the description if CLI behavior was updated or added.
  • PR title follows Conventional Commits format

@gotbadger
Copy link
Contributor

closed in favour of #1512

@gotbadger gotbadger closed this Feb 22, 2024
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