Skip to content

Commit 30fb81c

Browse files
AlbertoGPlunny
authored andcommitted
Use issue number/index instead of id for API URL. (#3298)
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. For instance, in a new repo in try.gitea.io with just one issue: [{ "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.
1 parent 9f8349a commit 30fb81c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (issue *Issue) GetIsRead(userID int64) error {
248248

249249
// APIURL returns the absolute APIURL to this issue.
250250
func (issue *Issue) APIURL() string {
251-
return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.ID))
251+
return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.Index))
252252
}
253253

254254
// HTMLURL returns the absolute URL to this issue.

0 commit comments

Comments
 (0)