Closed
Description
- Gitea version (or commit ref): 4f42e03
- Git version: 2.19.1.windows.1
- Operating system: Windows 10
- Database (use
[x]
):- PostgreSQL
- [ x] MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- [ x] Not relevant
- Log gist:
2019/12/20 22:25:14 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: index out of range
E:/Go/src/runtime/panic.go:44 (0x42fbc1)
panicindex: panic(indexError)
E:/dev/Go/src/code.gitea.io/gitea/modules/repofiles/tree.go:82 (0x123b1a5)
GetTreeBySHA: tree.Entries[e].Path = entries[e].Name()
E:/dev/Go/src/code.gitea.io/gitea/routers/api/v1/repo/tree.go:59 (0x143d95c)
GetTree: if tree, err := repofiles.GetTreeBySHA(ctx.Repo.Repository, sha, ctx.QueryInt("page"), ctx.QueryInt("per_page"), ctx.QueryBool("recursive")); err != nil {
Description
Issue with paging on /repos/{owner}/{repo}/git/trees/{sha} api, any page other than page 1 that should returns items throws an error 500
Reproduced with super simple repo with only 2 items:
works as expected:
http://localhost:3000/api/v1/repos/balbright2/awesomecode/git/trees/master?recursive=true&per_page=1&page=1
throws error 500:
http://localhost:3000/api/v1/repos/balbright2/awesomecode/git/trees/master?recursive=true&per_page=1&page=2
Log snippet above
...