• Yorick Peterse's avatar
    Handle encoding in non-binary Blob instances · 0bc443e3
    Yorick Peterse authored
    gitlab_git 10.6.4 relies on Rugged marking blobs as binary or not,
    instead of relying on Linguist. Linguist in turn would mark text blobs
    as binary whenever they would contain byte sequences that could not be
    encoded using UTF-8.
    
    However, marking such blobs as binary is not correct. If one pushes a
    Markdown document with invalid character sequences it's still a text
    based Markdown document and not some random binary blob.
    
    This commit overwrites Blob#data so it automatically converts text-based
    content to UTF-8 (the encoding we use everywhere else) while taking care
    of replacing any invalid sequences with the UTF-8 replacement character.
    The data of binary blobs is left as-is.
    0bc443e3
blob_spec.rb 3.48 KB