forgejo/modules
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
..
actions
activitypub enhance test & fix reviews 2024-05-14 08:24:31 +02:00
analyze
assetfs
auth
avatar
base Refactor sha1 and time-limited code (#31023) 2024-05-26 18:43:30 +02:00
cache
charset
container
csv
emoji
eventsource
forgefed fix review 2024-05-29 18:31:06 +02:00
generate
git Refactor sha1 and time-limited code (#31023) 2024-05-26 18:43:30 +02:00
gitgraph
gitrepo
graceful
hcaptcha
highlight
hostmatcher
html
httpcache
httplib
indexer Merge pull request '[gitea] week 2024-23 cherry pick (gitea/main -> forgejo)' (#3989) from earl-warren/wcp/2024-23 into forgejo 2024-06-04 07:40:35 +00:00
issue/template Support setting the default attribute of the issue template dropdown field (#31045) 2024-05-26 20:13:09 +02:00
json
label
lfs
log
markup Add MAX_ROWS option for CSV rendering (#30268) 2024-06-09 16:04:57 +02:00
mcaptcha
metrics Rename project board -> column to make the UI less confusing (#30170) 2024-06-02 09:42:39 +02:00
migration
nosql
optional
options
packages
paginator
pprof
private Move database operations of merging a pull request to post receive hook and add a transaction (#30805) 2024-05-12 20:03:10 +02:00
process
proxy
proxyprotocol
public
queue chore(deps): update module github.com/redis/go-redis/v9 to v9.5.2 2024-06-04 12:38:35 +02:00
recaptcha
references
regexplru
repository fix: hook post-receive for sha256 repos 2024-05-15 16:43:16 +02:00
secret
session
setting Add MAX_ROWS option for CSV rendering (#30268) 2024-06-09 16:04:57 +02:00
sitemap
ssh
storage test(avatar): deleting a user avatar is idempotent 2024-06-05 09:10:42 +02:00
structs Document possible action types for the user activity feed API (#31196) 2024-06-09 11:13:39 +02:00
svg
sync
system
templates Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
test test(util): MockProtect when mocking multiple times 2024-06-02 15:24:06 +02:00
testlogger
timeutil
translation
turnstile
typesniffer
updatechecker
uri
user
util
validation added validation fixes 2024-05-14 08:31:34 +02:00
web
webhook