Skip to content

Commit 0831da7

Browse files
Reduced the maxRows limit from 100k to 2.5k
1 parent f095a38 commit 0831da7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/markup/csv/csv.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ package markup
55

66
import (
77
"bufio"
8+
"code.gitea.io/gitea/modules/util"
89
"html"
910
"io"
10-
"net/url"
1111
"regexp"
1212
"strconv"
1313

@@ -134,18 +134,18 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
134134
// Check if maxRows or maxSize is reached, and if true, warn.
135135
if (row >= maxRows && maxRows != 0) || (rd.InputOffset() >= maxSize && maxSize != 0) {
136136
warn := `<table class="data-table"><tr><td>`
137-
raw_link := ` <a href="` + ctx.Links.RawLink() + `/` + url.PathEscape(ctx.RelativePath) + `">`
137+
rawLink := ` <a href="` + ctx.Links.RawLink() + `/` + util.PathEscapeSegments(ctx.RelativePath) + `">`
138138

139139
// Try to get the user translation
140140
if locale, ok := ctx.Ctx.Value(translation.ContextKey).(translation.Locale); ok {
141141
warn += locale.TrString("repo.file_too_large")
142-
raw_link += locale.TrString("repo.file_view_raw")
142+
rawLink += locale.TrString("repo.file_view_raw")
143143
} else {
144144
warn += "The file is too large to be shown."
145-
raw_link += "View Raw"
145+
rawLink += "View Raw"
146146
}
147147

148-
warn += raw_link + `</a></td></tr></table>`
148+
warn += rawLink + `</a></td></tr></table>`
149149

150150
// Write the HTML string to the output
151151
if _, err := tmpBlock.WriteString(warn); err != nil {

0 commit comments

Comments
 (0)