mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-08 14:47:44 +00:00
fix: misc fixes in pub/gpg/tests (#38809)
- The pub registry reported the oldest version as `latest`, because the descriptor slice is sorted ascending but the first element was used. - Verifying a GPG or SSH key flashed success and redirected after already writing an error response, so a failure was reported as a success with an empty key id. - Test packages sharing redis could tear down each other's server. `PrepareTestRedis` started its own on the well-known port, so a package running in parallel borrowed it and lost it when the owner's cleanup fired. It now listens on a socket of its own.
This commit is contained in:
@@ -108,7 +108,7 @@ func EnumeratePackageVersions(ctx *context.Context) {
|
||||
|
||||
jsonResponse(ctx, http.StatusOK, &packageVersions{
|
||||
Name: pds[0].Package.Name,
|
||||
Latest: packageDescriptorToMetadata(baseURL, pds[0]),
|
||||
Latest: versions[len(versions)-1], // versions mirrors pds, sorted ascending
|
||||
Versions: versions,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ func KeysPost(ctx *context.Context) {
|
||||
default:
|
||||
ctx.ServerError("VerifyGPG", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.verify_gpg_key_success", keyID))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
@@ -232,6 +233,7 @@ func KeysPost(ctx *context.Context) {
|
||||
default:
|
||||
ctx.ServerError("VerifySSH", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.verify_ssh_key_success", fingerprint))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
|
||||
Reference in New Issue
Block a user