summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto González Palomo <bugs@sentido-labs.com>2018-01-04 02:41:33 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2018-01-03 19:41:33 -0600
commit30fb81c71ef8d452746194b4d9187424f6d11d81 (patch)
tree2984d3ac6cde9ca5c26c85c27b4c2ca5ccdbc67f
parent9f8349af063ab0d35b65b1c4246799f023b68e7f (diff)
downloadgitea-30fb81c71ef8d452746194b4d9187424f6d11d81.tar.gz
gitea-30fb81c71ef8d452746194b4d9187424f6d11d81.zip
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.
-rw-r--r--models/issue.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/issue.go b/models/issue.go
index 3bd45396dc..d10c521db6 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -248,7 +248,7 @@ func (issue *Issue) GetIsRead(userID int64) error {
// APIURL returns the absolute APIURL to this issue.
func (issue *Issue) APIURL() string {
- return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.ID))
+ return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.Index))
}
// HTMLURL returns the absolute URL to this issue.