@@ -39,8 +39,8 @@ func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule {
39
39
{Element : "table" , AllowAttr : "class" , Regexp : regexp .MustCompile (`data-table` )},
40
40
{Element : "th" , AllowAttr : "class" , Regexp : regexp .MustCompile (`line-num` )},
41
41
{Element : "td" , AllowAttr : "class" , Regexp : regexp .MustCompile (`line-num` )},
42
- {Element : "div" , AllowAttr : "class" , Regexp : regexp .MustCompile (`tw-flex tw-justify-center tw-items-center` )},
43
- {Element : "a" , AllowAttr : "href" , Regexp : regexp .MustCompile (`\?display=source ` )},
42
+ {Element : "div" , AllowAttr : "class" , Regexp : regexp .MustCompile (`tw-flex tw-justify-center tw-items-center tw-py-4 tw-text-14 ` )},
43
+ {Element : "a" , AllowAttr : "href" , Regexp : regexp .MustCompile (`` )},
44
44
}
45
45
}
46
46
@@ -81,7 +81,6 @@ func writeField(w io.Writer, element, class, field string) error {
81
81
// Render implements markup.Renderer
82
82
func (r Renderer ) Render (ctx * markup.RenderContext , input io.Reader , output io.Writer ) error {
83
83
tmpBlock := bufio .NewWriter (output )
84
- warnBlock := bufio .NewWriter (tmpBlock )
85
84
maxSize := setting .UI .CSV .MaxFileSize
86
85
maxRows := setting .UI .CSV .MaxRows
87
86
@@ -129,23 +128,22 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
129
128
row ++
130
129
}
131
130
131
+ if _ , err = tmpBlock .WriteString ("</table>" ); err != nil {
132
+ return err
133
+ }
134
+
132
135
// Check if maxRows or maxSize is reached, and if true, warn.
133
136
if (row >= maxRows && maxRows != 0 ) || (rd .InputOffset () >= maxSize && maxSize != 0 ) {
134
137
locale := ctx .Ctx .Value (translation .ContextKey ).(translation.Locale )
135
138
136
139
// Construct the HTML string
137
- warn := `<div class="tw-flex tw-justify-center tw-items-center"><div>` + locale .TrString ("repo.file_too_large" ) + ` <a class="source" href="?display=source ">` + locale .TrString ("repo.file_view_source " ) + `</a></div></div>`
140
+ warn := `<div class="tw-flex tw-justify-center tw-items-center tw-py-4 tw-text-14 "><div>` + locale .TrString ("repo.file_too_large" ) + ` <a class="source" href="` + ctx . Links . RawLink () + `/` + ctx . RelativePath + ` ">` + locale .TrString ("repo.file_view_raw " ) + `</a></div></div>`
138
141
139
142
// Write the HTML string to the output
140
- if _ , err := warnBlock .WriteString (warn ); err != nil {
141
- return err
142
- }
143
- if err = warnBlock .Flush (); err != nil {
143
+ if _ , err := tmpBlock .WriteString (warn ); err != nil {
144
144
return err
145
145
}
146
146
}
147
- if _ , err = tmpBlock .WriteString ("</table>" ); err != nil {
148
- return err
149
- }
147
+
150
148
return tmpBlock .Flush ()
151
149
}
0 commit comments