Skip to content

New admin endpoints getAllOrgs and getAllUsers cause internal server error #6126

@jgoldring

Description

@jgoldring
  • Gitea version (or commit ref): master (2982413)
  • Git version: 2.20.1
  • Operating system: Arch Linux
  • Database (use [x]): (tested with both)
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io: (Don't have admin rights)
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: http response
    gitea log

Description

The newly created admin endpoints getAllOrgs and getAllUsers return 500 errors right now. The returned error in the gist: PANIC:: runtime error: makeslice: cap out of range seems to be caused by a change made in commit: https://github.com/bmackinney/gitea/commit/df619cf35cab1173c329bc9099b62547cae21080

specifically in models/user.go, changing the <= to == when comparing the PageSize:

if opts.PageSize <= 0 || opts.PageSize > setting.UI.ExplorePagingNum {

to:

if opts.PageSize == 0 || opts.PageSize > setting.UI.ExplorePagingNum {

This change allows the value of -1 passed in by both calls to pass through to the call:

users = make([]*User, 0, opts.PageSize)

with PageSize still being set at -1, causing the "cap out of range" error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions