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 Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
activitypub enhance test & fix reviews 2024-05-14 08:24:31 +02:00
analyze
assetfs
auth Remove external API calls in TestPassword (#30716) 2024-05-05 12:15:40 +01:00
avatar Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
base Refactor sha1 and time-limited code (#31023) 2024-05-26 18:43:30 +02:00
cache
charset s/Gitea/Forgejo in various log messages and comments 2024-04-21 21:26:15 +05:00
container Add container.FilterSlice function (gitea#30339) 2024-04-16 11:49:44 +02:00
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 Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
gitrepo
graceful
hcaptcha
highlight
hostmatcher
html
httpcache
httplib Skip gzip for some well-known compressed file types (#30796) 2024-05-05 12:15:40 +01:00
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 Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
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 s/Gitea/Forgejo in various log messages and comments 2024-04-21 21:26:15 +05:00
optional Resolve lint for unused parameter and unnecessary type arguments (#30750) 2024-05-05 08:38:16 +01:00
options
packages Add support for npm bundleDependencies (#30751) 2024-05-05 08:24:01 +01:00
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 Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
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 Avoid importing modules/web/middleware in modules/session (#30584) 2024-04-21 16:28:16 +02:00
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 Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
timeutil
translation
turnstile
typesniffer Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
updatechecker
uri
user
util Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
validation added validation fixes 2024-05-14 08:31:34 +02:00
web Avoid importing modules/web/middleware in modules/session (#30584) 2024-04-21 16:28:16 +02:00
webhook