mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +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 url = ApiPath(s"/api/v3/repos/${full_name}")
|
||||||
val clone_url = ApiPath(s"/git/${full_name}.git")
|
val clone_url = ApiPath(s"/git/${full_name}.git")
|
||||||
val html_url = ApiPath(s"/${full_name}")
|
val html_url = ApiPath(s"/${full_name}")
|
||||||
val ssh_url = Some(SshPath(""))
|
val ssh_url = Some(SshPath(s"/${full_name}.git"))
|
||||||
}
|
}
|
||||||
|
|
||||||
object ApiRepository {
|
object ApiRepository {
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
sender,
|
sender,
|
||||||
repository,
|
repository,
|
||||||
owner,
|
owner,
|
||||||
ref = newBranchName,
|
ref = s"refs/heads/${newBranchName}",
|
||||||
refType = "branch"
|
refType = "branch"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1017,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
WebHookPushPayload(
|
WebHookPushPayload(
|
||||||
git,
|
git,
|
||||||
pusherAccount,
|
pusherAccount,
|
||||||
newBranchName,
|
s"refs/heads/${newBranchName}",
|
||||||
repository,
|
repository,
|
||||||
List(),
|
List(),
|
||||||
ownerAccount,
|
ownerAccount,
|
||||||
@@ -1036,7 +1036,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
sender,
|
sender,
|
||||||
repository,
|
repository,
|
||||||
owner,
|
owner,
|
||||||
ref = newBranchName,
|
ref = s"refs/heads/${newBranchName}",
|
||||||
refType = "branch"
|
refType = "branch"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ object SystemSettingsService {
|
|||||||
if (isDefaultPort) {
|
if (isDefaultPort) {
|
||||||
s"${genericUser}@${host}"
|
s"${genericUser}@${host}"
|
||||||
} else {
|
} else {
|
||||||
s"${genericUser}@${host}:${port}"
|
s"ssh://${genericUser}@${host}:${port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
def getUrl(owner: String, name: String): String =
|
def getUrl(owner: String, name: String): String =
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ class GitBucketReceivePackFactory extends ReceivePackFactory[HttpServletRequest]
|
|||||||
|
|
||||||
val settings = loadSystemSettings()
|
val settings = loadSystemSettings()
|
||||||
val baseUrl = settings.baseUrl(request)
|
val baseUrl = settings.baseUrl(request)
|
||||||
val sshUrl = settings.sshUrl(owner, repository)
|
val sshUrl = settings.sshUrl
|
||||||
|
|
||||||
if (!repository.endsWith(".wiki")) {
|
if (!repository.endsWith(".wiki")) {
|
||||||
val hook = new CommitLogHook(owner, repository, pusher, baseUrl, sshUrl)
|
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)
|
val receive = new ReceivePack(repository)
|
||||||
if (!repoName.endsWith(".wiki")) {
|
if (!repoName.endsWith(".wiki")) {
|
||||||
val hook =
|
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.setPreReceiveHook(hook)
|
||||||
receive.setPostReceiveHook(hook)
|
receive.setPostReceiveHook(hook)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class SystemSettingsServiceSpec extends AnyWordSpecLike with Matchers {
|
|||||||
"getUrl" which {
|
"getUrl" which {
|
||||||
"returns the port number when not using port 22" in new MockContext {
|
"returns the port number when not using port 22" in new MockContext {
|
||||||
override val port = 8022
|
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 {
|
"leaves off the port number when using port 22" in new MockContext {
|
||||||
override val port = 22
|
override val port = 22
|
||||||
|
|||||||
Reference in New Issue
Block a user