You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
…22921)
Close: #22910
---
I'm confused about that why does the api (`GET
/repos/{owner}/{repo}/pulls/{index}/files`) require caller to pass the
parameters `limit` and `page`.
In my case, the caller only needs to pass a `skip-to` to paging. This is
consistent with the api `GET /{owner}/{repo}/pulls/{index}/files`
So, I deleted the code related to `listOptions`
---------
Co-authored-by: Lunny Xiao <[email protected]>
Description
When calling the
GET /repos/{owner}/{repo}/pulls/{index}/files
endpoint theMAX_RESPONSE_ITEMS
config parameter is correctly respected, but also theMAX_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:
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 apage=2
parameter, an error is produced: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
https://gist.github.com/rlogiacco/8a605132a73515f2c9277333a4e27b81
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
The text was updated successfully, but these errors were encountered: