"Invalid base64" error during external diffs migration
Summary
Some merge_request_diff_files
have binary: true
and data: <invalid base64>
. These trip up the external diffs migration (and are unreadable generally)
Steps to reproduce
Sentry issue: https://sentry.gitlab.net/gitlab/gitlabcom/issues/1775985/
What is the current bug behavior?
ArgumentError: invalid base64
from merge_request_diff_file.rb:28:in `unpack1'
from merge_request_diff_file.rb:28:in `diff'
from gitlab/metrics/instrumentation.rb:160:in `block in diff'
from gitlab/metrics/method_call.rb:27:in `measure'
from gitlab/metrics/instrumentation.rb:160:in `diff'
from diff_file.rb:9:in `to_hash'
from merge_request_diff.rb:535:in `block in build_merge_request_diff_files'
What is the expected correct behavior?
Hard to say. Invalid base64-encoded diffs shouldn't exist, but given they do, what should we do with them?
Worth digging more into the exact form of invalid that this takes.
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)