API issue URL is wrong, uses .id instead of .number #1420

Closed
opened 2025-11-02 04:00:14 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @AlbertoGP on GitHub (Jan 3, 2018).

  • Gitea version (or commit ref): 1.3.2
  • Git version: 2.14.1
  • Operating system: Ubuntu Linux 17.10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: not for the test case at try.gitea.io, but from my server:
    2018/01/03 18:08:42 [...outers/repo/issue.go:484 ViewIssue()] [E] GetIssueByIndex: issue does not exist [id: 0, repo_id: 6, index: 7]

Description

Using the API calls, the issue objects retrieved by /repos/{owner}/{repo}/issues
contains the wrong value in the "url" field: it uses the "id" value instead of the "number" value.

To reproduce it in try.gitea.io, I created a repo with one issue:
https://try.gitea.io/api/v1/repos/AlbertoGP/uno/issues/

The issue number is 1, but the id is 896 and that's the value Gitea uses to build the "url" field:

[{
  "id": 896,
  "url": "https://try.gitea.io/api/v1/repos/AlbertoGP/uno/issues/896",
  "number": 1,
   ...
}]

The given URL does not work, but if you replace the "896" by "1" it does.

Originally created by @AlbertoGP on GitHub (Jan 3, 2018). - Gitea version (or commit ref): 1.3.2 - Git version: 2.14.1 - Operating system: Ubuntu Linux 17.10 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: not for the test case at try.gitea.io, but from my server: 2018/01/03 18:08:42 [...outers/repo/issue.go:484 ViewIssue()] [E] GetIssueByIndex: issue does not exist [id: 0, repo_id: 6, index: 7] ## Description Using the API calls, the issue objects retrieved by /repos/{owner}/{repo}/issues contains the wrong value in the "url" field: it uses the "id" value instead of the "number" value. To reproduce it in try.gitea.io, I created a repo with one issue: https://try.gitea.io/api/v1/repos/AlbertoGP/uno/issues/ The issue number is 1, but the id is 896 and that's the value Gitea uses to build the "url" field: ``` [{ "id": 896, "url": "https://try.gitea.io/api/v1/repos/AlbertoGP/uno/issues/896", "number": 1, ... }] ``` The given URL does not work, but if you replace the "896" by "1" it does.
GiteaMirror added the type/bug label 2025-11-02 04:00:14 -06:00
Author
Owner

@lunny commented on GitHub (Jan 4, 2018):

resolved by #3298

@lunny commented on GitHub (Jan 4, 2018): resolved by #3298
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1420