Skip to content

Can't create a merge request containing a binary file with non-UTF-8 characters

See https://gitlab.com/gitlab-org/gitlab-ce/commit/9a73b634ab4220f68a8296ccb582a68293874489#note_35750145 and below.

This was introduced in 9.4.0. Previously, we stored MR diffs as serialised YAML text in a text field. Now, we store them in a table with columns for each attribute of the hash, and the diff itself is stored in a text field.

However, Psych tags binary values and encodes them as base 64 if they aren't ASCII-compatible:

We need to do the same thing here, and add a boolean binary column to this table. I think we can get away with the simpler check, like in https://github.com/ruby/psych/commit/8949a47b8cee31e03e21608406ba116adcf74054.

This will also be necessary when migrating the legacy data, as in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12685.