aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcrystal <71373843+CrystalCommunication@users.noreply.github.com>2023-02-01 15:06:58 -0700
committerGitHub <noreply@github.com>2023-02-01 22:06:58 +0000
commit9cde526f874503032d710e4b3c05ef99d4a12524 (patch)
tree68261c8ba57439aa47a8ac76c0965c1f0c69bb7c
parent4c20be7c00179d404175efc787551328a73696f5 (diff)
downloadgitea-9cde526f874503032d710e4b3c05ef99d4a12524.tar.gz
gitea-9cde526f874503032d710e4b3c05ef99d4a12524.zip
Fix line spacing for plaintext previews (#22699) (#22701)
Backport #22699 Adding `<br>` between each line is not necessary since the entire file is rendered inside a `<pre>` fixes https://codeberg.org/Codeberg/Community/issues/915
-rw-r--r--modules/charset/escape.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/modules/charset/escape.go b/modules/charset/escape.go
index e600998937..df10c8fbd0 100644
--- a/modules/charset/escape.go
+++ b/modules/charset/escape.go
@@ -45,7 +45,7 @@ func EscapeControlReader(reader io.Reader, writer io.Writer, locale translation.
return streamer.escaped, err
}
-// EscapeControlStringReader escapes the unicode control sequences in a provided reader of string content and writer in a locale and returns the findings as an EscapeStatus and the escaped []byte
+// EscapeControlStringReader escapes the unicode control sequences in a provided reader of string content and writer in a locale and returns the findings as an EscapeStatus and the escaped []byte. HTML line breaks are not inserted after every newline by this method.
func EscapeControlStringReader(reader io.Reader, writer io.Writer, locale translation.Locale, allowed ...rune) (escaped *EscapeStatus, err error) {
bufRd := bufio.NewReader(reader)
outputStream := &HTMLStreamerWriter{Writer: writer}
@@ -66,10 +66,6 @@ func EscapeControlStringReader(reader io.Reader, writer io.Writer, locale transl
}
break
}
- if err := streamer.SelfClosingTag("br"); err != nil {
- streamer.escaped.HasError = true
- return streamer.escaped, err
- }
}
return streamer.escaped, err
}