Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with paging on /repos/{owner}/{repo}/git/trees/{sha} api #9453

Closed
5 tasks
bhalbright opened this issue Dec 21, 2019 · 2 comments
Closed
5 tasks

Issue with paging on /repos/{owner}/{repo}/git/trees/{sha} api #9453

bhalbright opened this issue Dec 21, 2019 · 2 comments
Labels
Milestone

Comments

@bhalbright
Copy link
Contributor

  • 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
...

@bhalbright
Copy link
Contributor Author

I intend to submit a PR for this issue when I can fix it. This was actually found by an Unfolding Word developer https://github.com/unfoldingWord.

@lunny
Copy link
Member

lunny commented Dec 22, 2019

Fixed by #9459

@lunny lunny closed this as completed Dec 22, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants