diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 53dccdd97d..d26a0eb41f 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1335,7 +1335,7 @@ LEVEL = Info ;MAX_FILE_SIZE = 524288 ;; ;; Maximum allowed rows to render CSV files. (Set to 0 for no limit) -;MAX_ROWS = 5000 +;MAX_ROWS = 100000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/modules/markup/csv/csv.go b/modules/markup/csv/csv.go index 8b49f3da44..9c2e4aeebb 100644 --- a/modules/markup/csv/csv.go +++ b/modules/markup/csv/csv.go @@ -39,8 +39,8 @@ func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule { {Element: "table", AllowAttr: "class", Regexp: regexp.MustCompile(`data-table`)}, {Element: "th", AllowAttr: "class", Regexp: regexp.MustCompile(`line-num`)}, {Element: "td", AllowAttr: "class", Regexp: regexp.MustCompile(`line-num`)}, - {Element: "div", AllowAttr: "class", Regexp: regexp.MustCompile(`tw-flex tw-justify-center tw-items-center`)}, - {Element: "a", AllowAttr: "href", Regexp: regexp.MustCompile(`\?display=source`)}, + {Element: "div", AllowAttr: "class", Regexp: regexp.MustCompile(`tw-flex tw-justify-center tw-items-center tw-py-4 tw-text-14`)}, + {Element: "a", AllowAttr: "href", Regexp: regexp.MustCompile(``)}, } } @@ -81,7 +81,6 @@ func writeField(w io.Writer, element, class, field string) error { // Render implements markup.Renderer func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error { tmpBlock := bufio.NewWriter(output) - warnBlock := bufio.NewWriter(tmpBlock) maxSize := setting.UI.CSV.MaxFileSize maxRows := setting.UI.CSV.MaxRows @@ -129,23 +128,22 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W row++ } + if _, err = tmpBlock.WriteString(""); err != nil { + return err + } + // Check if maxRows or maxSize is reached, and if true, warn. if (row >= maxRows && maxRows != 0) || (rd.InputOffset() >= maxSize && maxSize != 0) { locale := ctx.Ctx.Value(translation.ContextKey).(translation.Locale) // Construct the HTML string - warn := `