[Bug] [Api] /orgs/{:orgname}/repos POST endpoint is broken #5363

Closed
opened 2025-11-02 06:22:39 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @iondune on GitHub (May 8, 2020).

Description

I am having trouble using the POST /orgs/<org_name>/repos api endpoint. This is the response I'm getting (with http status 422):

{"message":"org does not exist [id: 0, name: ]","url":"https://try.gitea.io/api/swagger"}

But if I switch to the deprecated /org/<org_name>/repos endpoint, it works just fine. It looks to me like the issue is that CreateOrgRepo is looking for the :org parameter here while the parameter in the route is named :orgname here. The deprecated route is working because it uses :org.

Originally created by @iondune on GitHub (May 8, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.12.0+dev-87-g665d7e91a - Git version: - Operating system: Ubuntu 18.04.3 LTS - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (https://try.gitea.io/api/v1/orgs/test_org_3333/repos) - [ ] No - [ ] Not relevant - Log gist: https://gist.github.com/iondune/57330f7f5eb4f62b55992aab9b404d2b ## Description I am having trouble using the POST `/orgs/<org_name>/repos` api endpoint. This is the response I'm getting (with http status 422): ```json {"message":"org does not exist [id: 0, name: ]","url":"https://try.gitea.io/api/swagger"} ``` But if I switch to the deprecated `/org/<org_name>/repos` endpoint, it works just fine. It looks to me like the issue is that `CreateOrgRepo` is looking for the `:org` parameter [here](https://github.com/go-gitea/gitea/blob/master/routers/api/v1/repo/repo.go#L334) while the parameter in the route is named `:orgname` [here](https://github.com/go-gitea/gitea/blob/master/routers/api/v1/api.go#L861). The deprecated route is working because it uses `:org`.
GiteaMirror added the type/bug label 2025-11-02 06:22:39 -06:00
Author
Owner

@zeripath commented on GitHub (May 12, 2020):

Fixed by #11339 and the breakout backport #11381

@zeripath commented on GitHub (May 12, 2020): Fixed by #11339 and the breakout backport #11381
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5363