Forgejo/modules/markup
Henrique Pimentel 433b6c6910
Add MAX_ROWS option for CSV rendering (#30268)
This solution implements a new config variable MAX_ROWS, which
corresponds to the “Maximum allowed rows to render CSV files. (0 for no
limit)” and rewrites the Render function for CSV files in markup module.
Now the render function only reads the file once, having MAX_FILE_SIZE+1
as a reader limit and MAX_ROWS as a row limit. When the file is larger
than MAX_FILE_SIZE or has more rows than MAX_ROWS, it only renders until
the limit, and displays a user-friendly warning informing that the
rendered data is not complete, in the user's language.

---

Previously, when a CSV file was larger than the limit, the render
function lost its function to render the code. There were also multiple
reads to the file, in order to determine its size and render or
pre-render.

The warning: ![image](https://s3.amazonaws.com/i.snag.gy/vcKh90.jpg)

(cherry picked from commit f7125ab61aaa02fd4c7ab0062a2dc9a57726e2ec)
2024-06-09 16:04:57 +02:00
..
asciicast Support asciicast files as new markup (#22448) 2023-01-18 08:46:58 +08:00
common [GITEA] test markdown CleanValue to prevent regression 2024-02-05 16:09:41 +01:00
console Add context when rendering labels or emojis (#23281) 2023-03-05 22:59:05 +01:00
csv Add MAX_ROWS option for CSV rendering (#30268) 2024-06-09 16:04:57 +02:00
external Rework markup link rendering (#26745) 2024-01-15 08:49:24 +00:00
markdown Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
mdstripper Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
orgmode Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
tests/repo/repo1_filepreview Update test 2024-03-28 04:20:13 +01:00
camo.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
camo_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
file_preview.go Fix issue where rendering stops after the first invalid parmalink 2024-04-19 18:21:21 +02:00
html.go markup: Allow cross references to contain URL query parameters too 2024-05-01 21:14:16 +02:00
html_internal_test.go markup: Allow cross references to contain URL query parameters too 2024-05-01 21:14:16 +02:00
html_test.go markup: Allow cross references to contain URL query parameters too 2024-05-01 21:14:16 +02:00
renderer.go Merge pull request 'Render inline file permalinks' (#2669) from Mai-Lapyst/forgejo:markup-add-filepreview into forgejo 2024-04-01 13:57:01 +00:00
renderer_test.go Move IsReadmeFile* from modules/markup/ to modules/util (#22877) 2023-02-13 15:01:09 -05:00
sanitizer.go [BUG] Center icon and callout text 2024-04-03 22:26:19 +02:00
sanitizer_test.go Use restricted sanitizer for repository description (#28141) 2023-11-23 16:34:25 +00:00