• Nick Thomas's avatar
    Fall back to the raw diff if base64 encoding fails · e9ac3df7
    Nick Thomas authored
    A small number of merge request diff files have `binary: true` set
    inappropriately. During the external diffs migration on GitLab.com,
    approximately 30 in every million (0.003%) fail because the `diffs`
    column is the plain diff, rather than the base64-encoded diff.
    
    It would be nicer to correct the data, but a quick and easy fix is to
    fall back to the raw column data if the diff is unreadable as base64.
    
    This is particularly safe because the data must *also* be processed as
    a diff before being shown to the user, and two characters very commonly
    seen in diffs - `-` and `@` - are not valid base64 characters.
    
    This change will fix display and migration of these broken diffs, and
    as a happy side effect, the migration to external storage, along with
    this change, will also fix the `binary` column for us, so the error
    will correct over time.
    e9ac3df7
merge_request_diff_file.rb 1015 Bytes