1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix EOL handling in web editor (#27141) (#27234)

Backport #27141 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/27136.

This does the following for Monaco's EOL setting:

1. Use editorconfig setting if present
2. Use the file's dominant line ending as detected by monaco, which uses
LF for empty file

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Giteabot
2023-09-25 06:10:38 +08:00
committed by GitHub
parent 134c7636ef
commit a1029cb2ca
3 changed files with 22 additions and 6 deletions

View File

@@ -287,7 +287,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
Operation: operation,
FromTreePath: ctx.Repo.TreePath,
TreePath: form.TreePath,
ContentReader: strings.NewReader(strings.ReplaceAll(form.Content, "\r", "")),
ContentReader: strings.NewReader(form.Content),
},
},
Signoff: form.Signoff,