diff options
author | Unknwon <u@gogs.io> | 2016-08-28 05:32:10 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-28 05:32:10 -0700 |
commit | 429c92c0ce15213e52fdacb3d28ee2f3a3a5a63f (patch) | |
tree | a8818947491236250542c474656501b1cf84fb3d /routers/repo/editor.go | |
parent | 579e5e4fee59f01f8a438e7ef977f34fa5dba72c (diff) | |
download | gitea-429c92c0ce15213e52fdacb3d28ee2f3a3a5a63f.tar.gz gitea-429c92c0ce15213e52fdacb3d28ee2f3a3a5a63f.zip |
#3516 enforce line ending to be \n from web editor
Diffstat (limited to 'routers/repo/editor.go')
-rw-r--r-- | routers/repo/editor.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go index 4a82f291e8..9346593daa 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -263,7 +263,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo OldTreeName: oldTreePath, NewTreeName: form.TreePath, Message: message, - Content: form.Content, + Content: strings.Replace(form.Content, "\r", "", -1), IsNewFile: isNewFile, }); err != nil { ctx.Data["Err_TreePath"] = true @@ -284,7 +284,6 @@ func NewFilePost(ctx *context.Context, form auth.EditRepoFileForm) { func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) { treePath := ctx.Repo.TreePath - content := form.Content entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treePath) if err != nil { @@ -295,7 +294,7 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) { return } - diff, err := ctx.Repo.Repository.GetDiffPreview(ctx.Repo.BranchName, treePath, content) + diff, err := ctx.Repo.Repository.GetDiffPreview(ctx.Repo.BranchName, treePath, form.Content) if err != nil { ctx.Error(500, "GetDiffPreview: "+err.Error()) return |