Prevent mutation of line endings when downloading or querying blob content

Summary

Line endings of files are different when downloading or querying file contents via GitLab compared to how they are stored in Git.

  • @justintobler started a discussion: (+4 comments)

    when I clone this project and inspect the contents of CRLF locally I can see the file contains \r\n line-endings. But when I download the file via the UI or query it via GraphQL the line endings are all changed to \n.

Steps to reproduce

  1. Git clone this example project.
  2. Open the file called CRLF in the cloned project and notice the line endings are \r\n.
  3. Download the file via GitLab or query the file contents via GraphQL and notice all line endings are changed to \n.
git cloned downloaded GraphQL
Screenshot_2024-02-27_at_23.06.27 Screenshot_2024-02-27_at_23.09.05 Screenshot_2024-02-27_at_23.10.59