File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -164,14 +164,18 @@ func editFile(ctx *context.Context, isNewFile bool) {
164164 // Only some file types are editable online as text.
165165 ctx .Data ["IsFileText" ] = typesniffer .DetectContentType (buf ).IsRepresentableAsText ()
166166
167- d , _ := io .ReadAll (dataRc )
168-
169- buf = append (buf , d ... )
170- if content , err := charset .ToUTF8 (buf , charset.ConvertOpts {KeepBOM : true }); err != nil {
171- log .Error ("ToUTF8: %v" , err )
172- ctx .Data ["FileContent" ] = string (buf )
167+ if blob .Size () >= setting .UI .MaxDisplayFileSize {
168+ ctx .Data ["IsFileTooLarge" ] = true
173169 } else {
174- ctx .Data ["FileContent" ] = content
170+ d , _ := io .ReadAll (dataRc )
171+
172+ buf = append (buf , d ... )
173+ if content , err := charset .ToUTF8 (buf , charset.ConvertOpts {KeepBOM : true }); err != nil {
174+ log .Error ("ToUTF8: %v" , err )
175+ ctx .Data ["FileContent" ] = string (buf )
176+ } else {
177+ ctx .Data ["FileContent" ] = content
178+ }
175179 }
176180 } else {
177181 // Append filename from query, or empty string to allow username the new file.
You can’t perform that action at this time.
0 commit comments