-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Description
When calling the GET /repos/{owner}/{repo}/pulls/{index}/files endpoint the MAX_RESPONSE_ITEMS config parameter is correctly respected, but also the MAX_GIT_DIFF_FILES config parameter is used and, if exceded, a index out of bounds error occurs.
All acceptable so far, but the pagination is also affected.
For example, with the following:
[git]
MAX_GIT_DIFF_FILES = 100
[api]
MAX_RESPONSE_ITEMS = 100
With a PR containing 120 files, the first request to the endpoint correctly returns the first 100 items with an header X-HasMore: true. When performing a call to the same endpoint with a page=2 parameter, an error is produced:
...common/middleware.go:71:1() [E] [63ebf818] PANIC: runtime error: index out of range [100] with length 100
I would expect the API endpoint to ignore the MAX_GIT_DIFF_FILES param...
If this is the intended behaviour I suggest to introduce an additional configuration parameter to determine how many files are visbile through the UI.
I've created a test repo and a reference PR: https://try.gitea.io/rlogiacco/api-limit/pulls/1
Gitea Version
1.18.3
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
Screenshots
No response
Git Version
2.36.4
Operating System
official docker image
How are you running Gitea?
Inside a docker swarm using a a docker-compose file encompassing a mysql database
Database
MySQL