fixed backend path for CreateIssueComment #46

Merged
lunny merged 1 commits from unknown repository into master 2017-03-13 01:37:12 +00:00
Owner

Author: @Funzinator

This fixes the wrong backend URL when creating issue comments.

Author: @Funzinator This fixes the wrong backend URL when creating issue comments.
Author
Owner

Author: @strk

What bug does this fix ? How to reproduce the bug ?

Author: @strk What bug does this fix ? How to reproduce the bug ?
Author
Owner

Author: @Funzinator

Hi,
The issue is, that I can't add comments to issues in gitea.

Let me elaborate a bit further how to reproduce the issue (assuming url and token are filled accordingly with gitea installation details):

client := gitea.NewClient(url, token)
opt := gitea.CreateIssueOption{Title: "Test"}
issue, err := client.CreateIssue("funzi", "test", opt)
if err != nil {
	log.Println(err)
}
optC := gitea.CreateIssueCommentOption{Body: "Test Comment"}
comm, err := client.CreateIssueComment("funzi", "test", issue.Index, optC)
if err != nil {
	log.Println(err)
}
log.Printf("%v", comm)

This will print:

2017/03/12 22:58:17 404 Not Found
2017/03/12 22:58:17 &{0    <nil>  0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC}

The 404 Not Found is caused by the wrong backend URL "/repos/:%s/:%s/issues/%d/comments" which contains colons. If you change it to "/repos/%s/%s/issues/%d/comments" like I did in the pull request, it works fine.

Author: @Funzinator Hi, The issue is, that I can't add comments to issues in gitea. Let me elaborate a bit further how to reproduce the issue (assuming `url` and `token` are filled accordingly with gitea installation details): ``` client := gitea.NewClient(url, token) opt := gitea.CreateIssueOption{Title: "Test"} issue, err := client.CreateIssue("funzi", "test", opt) if err != nil { log.Println(err) } optC := gitea.CreateIssueCommentOption{Body: "Test Comment"} comm, err := client.CreateIssueComment("funzi", "test", issue.Index, optC) if err != nil { log.Println(err) } log.Printf("%v", comm) ``` This will print: ``` 2017/03/12 22:58:17 404 Not Found 2017/03/12 22:58:17 &{0 <nil> 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC} ``` The `404 Not Found` is caused by the wrong backend URL `"/repos/:%s/:%s/issues/%d/comments"` which contains colons. If you change it to `"/repos/%s/%s/issues/%d/comments"` like I did in the pull request, it works fine.
Author
Owner

Author: @lunny

LGTM

Author: @lunny LGTM
Author
Owner

Author: @appleboy

LGTM

Author: @appleboy LGTM
Sign in to join this conversation.
No description provided.