0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-21 08:04:54 +02:00

Fix file content only read on new file

This commit is contained in:
bytedream 2025-05-05 18:55:47 +02:00
parent 6f3b69b900
commit e960fe34c5

View File

@ -300,7 +300,8 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
}
var contentReader io.ReadSeeker
if isNewFile && form.Content.Has() {
// form content only has data if file is representable as text, is not too large and not in lfs
if isNewFile || form.Content.Has() {
contentReader = strings.NewReader(strings.ReplaceAll(form.Content.Value(), "\r", ""))
}