aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/editor.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-09-24 21:51:02 +0200
committerGitHub <noreply@github.com>2023-09-24 19:51:02 +0000
commit3a187eace5643a3dc681f87bdd8d0edbb742aa8f (patch)
tree1345da1ee1ca0b2fac66a42c7f93357db508b869 /routers/web/repo/editor.go
parent8e23524b18f4075e7db3dc1a7270abc0d9793dcb (diff)
downloadgitea-3a187eace5643a3dc681f87bdd8d0edbb742aa8f.tar.gz
gitea-3a187eace5643a3dc681f87bdd8d0edbb742aa8f.zip
Fix EOL handling in web editor (#27141)
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
Diffstat (limited to 'routers/web/repo/editor.go')
-rw-r--r--routers/web/repo/editor.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 0a606582e5..9d9fee3a77 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -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,