Skip to content

Commit 98bb9e2

Browse files
committed
use Sprintf instead of path.Join
1 parent 0f2b571 commit 98bb9e2

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

models/issue.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package models
77

88
import (
99
"fmt"
10-
"path"
1110
"regexp"
1211
"sort"
1312
"strconv"
@@ -324,7 +323,7 @@ func (issue *Issue) GetIsRead(userID int64) error {
324323

325324
// APIURL returns the absolute APIURL to this issue.
326325
func (issue *Issue) APIURL() string {
327-
return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.Index))
326+
return fmt.Sprintf("%s/issues/%d", issue.Repo.APIURL(), issue.Index)
328327
}
329328

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

models/issue_comment.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package models
88

99
import (
1010
"fmt"
11-
"path"
1211
"strings"
1312

1413
"code.gitea.io/gitea/modules/git"
@@ -249,7 +248,7 @@ func (c *Comment) APIURL() string {
249248
return ""
250249
}
251250

252-
return c.Issue.Repo.APIURL() + "/" + path.Join("issues/comments", fmt.Sprint(c.ID))
251+
return fmt.Sprintf("%s/issues/comments/%d", c.Issue.Repo.APIURL(), c.ID)
253252
}
254253

255254
// IssueURL formats a URL-string to the issue

0 commit comments

Comments
 (0)