mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Fix ref and ssh_url in WebHook payloads (#3656)
This commit is contained in:
@@ -21,7 +21,7 @@ case class ApiRepository(
|
||||
val url = ApiPath(s"/api/v3/repos/${full_name}")
|
||||
val clone_url = ApiPath(s"/git/${full_name}.git")
|
||||
val html_url = ApiPath(s"/${full_name}")
|
||||
val ssh_url = Some(SshPath(""))
|
||||
val ssh_url = Some(SshPath(s"/${full_name}.git"))
|
||||
}
|
||||
|
||||
object ApiRepository {
|
||||
|
||||
@@ -629,7 +629,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
sender,
|
||||
repository,
|
||||
owner,
|
||||
ref = newBranchName,
|
||||
ref = s"refs/heads/${newBranchName}",
|
||||
refType = "branch"
|
||||
)
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
WebHookPushPayload(
|
||||
git,
|
||||
pusherAccount,
|
||||
newBranchName,
|
||||
s"refs/heads/${newBranchName}",
|
||||
repository,
|
||||
List(),
|
||||
ownerAccount,
|
||||
@@ -1036,7 +1036,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
sender,
|
||||
repository,
|
||||
owner,
|
||||
ref = newBranchName,
|
||||
ref = s"refs/heads/${newBranchName}",
|
||||
refType = "branch"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ object SystemSettingsService {
|
||||
if (isDefaultPort) {
|
||||
s"${genericUser}@${host}"
|
||||
} else {
|
||||
s"${genericUser}@${host}:${port}"
|
||||
s"ssh://${genericUser}@${host}:${port}"
|
||||
}
|
||||
|
||||
def getUrl(owner: String, name: String): String =
|
||||
|
||||
@@ -204,7 +204,7 @@ class GitBucketReceivePackFactory extends ReceivePackFactory[HttpServletRequest]
|
||||
|
||||
val settings = loadSystemSettings()
|
||||
val baseUrl = settings.baseUrl(request)
|
||||
val sshUrl = settings.sshUrl(owner, repository)
|
||||
val sshUrl = settings.sshUrl
|
||||
|
||||
if (!repository.endsWith(".wiki")) {
|
||||
val hook = new CommitLogHook(owner, repository, pusher, baseUrl, sshUrl)
|
||||
|
||||
@@ -183,7 +183,7 @@ class DefaultGitReceivePack(owner: String, repoName: String, baseUrl: String, ss
|
||||
val receive = new ReceivePack(repository)
|
||||
if (!repoName.endsWith(".wiki")) {
|
||||
val hook =
|
||||
new CommitLogHook(owner, repoName, userName(authType), baseUrl, Some(sshAddress.getUrl(owner, repoName)))
|
||||
new CommitLogHook(owner, repoName, userName(authType), baseUrl, Some(sshAddress.getUrl))
|
||||
receive.setPreReceiveHook(hook)
|
||||
receive.setPostReceiveHook(hook)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class SystemSettingsServiceSpec extends AnyWordSpecLike with Matchers {
|
||||
"getUrl" which {
|
||||
"returns the port number when not using port 22" in new MockContext {
|
||||
override val port = 8022
|
||||
sshAddress.getUrl shouldBe "git@code.these.solutions:8022"
|
||||
sshAddress.getUrl shouldBe "ssh://git@code.these.solutions:8022"
|
||||
}
|
||||
"leaves off the port number when using port 22" in new MockContext {
|
||||
override val port = 22
|
||||
|
||||
Reference in New Issue
Block a user