Skip to content

Commit fee6db4

Browse files
authored
Merge branch 'main' into fix/home-btn-layout-small-resolution-33160
2 parents fbeb882 + 9f560d4 commit fee6db4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

services/webhook/notifier.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
repo_model "code.gitea.io/gitea/models/repo"
1616
user_model "code.gitea.io/gitea/models/user"
1717
"code.gitea.io/gitea/modules/git"
18+
"code.gitea.io/gitea/modules/httplib"
1819
"code.gitea.io/gitea/modules/log"
1920
"code.gitea.io/gitea/modules/repository"
2021
"code.gitea.io/gitea/modules/setting"
@@ -871,14 +872,19 @@ func (m *webhookNotifier) CreateCommitStatus(ctx context.Context, repo *repo_mod
871872
return
872873
}
873874

875+
// as a webhook url, target should be an absolute url. But for internal actions target url
876+
// the target url is a url path with no host and port to make it easy to be visited
877+
// from multiple hosts. So we need to convert it to an absolute url here.
878+
target := httplib.MakeAbsoluteURL(ctx, status.TargetURL)
879+
874880
payload := api.CommitStatusPayload{
875881
Context: status.Context,
876882
CreatedAt: status.CreatedUnix.AsTime().UTC(),
877883
Description: status.Description,
878884
ID: status.ID,
879885
SHA: commit.Sha1,
880886
State: status.State.String(),
881-
TargetURL: status.TargetURL,
887+
TargetURL: target,
882888

883889
Commit: apiCommit,
884890
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),

0 commit comments

Comments
 (0)