Skip to content

Prevent mutation of line endings in the single file editor

What does this MR do and why?

Prevents mutating line endings in the single file editor by querying the file contents from the backend instead of getting it from editorEl.innerText.

Getting the value from editorEl.innerText mutates line endings from \r\n to \n. So querying the raw contents directly from the backend should prevent the mutation. Note, the backend still returns mutated line endings when querying the file contents, this will be taken care of in a follow-up.

Screenshots or screen recordings

No visual changes are expected, editing or creating a file via the single file editor should work exactly as it did before.

How to set up and validate locally

since line endings are still mutated on the backend it makes verifying these changes a bit difficult, please reach out if you need assistance.

  1. Open any source code in the Single file editor
  2. Editing the file should still work like before

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #426805 (closed)

Edited by Jacques Erasmus

Merge request reports