Skip to content

Commit

Permalink
Reduced the maxRows limit from 100k to 2.5k
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriquerPimentel committed May 14, 2024
1 parent 19be9d2 commit 3a6cf74
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/markup/csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package markup

import (
"bufio"
"code.gitea.io/gitea/modules/util"
"html"
"io"
"net/url"
"regexp"
"strconv"

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

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

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

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

0 comments on commit 3a6cf74

Please sign in to comment.