[Repository] Endline characters are getting ignored

Summary

End-line characters are getting ignored, when file content being copied from source file present in a repository.

Steps to reproduce

  1. Open any project.
  2. Copy some text from a file or click on copy source on clipboard (a copy sign present at uppermost right hand side of the text editor).
  3. Paste it in any text editor.

Example Project

Source file: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/repositories/base_service.rb.

Pasted content: https://gitlab.com/snippets/1977915.

What is the current bug behavior?

All end-line characters are getting ignored.

What is the expected correct behavior?

Pasted text should be as it's (no end-line characters should be ignored).

Output of checks

This bug happens on https://gitlab.com as well as on many other Gitlab instances.

Additionals