Fix stange behavior of DownloadPullDiffOrPatch in incorect index (#17223) (#17227)

Fix GetPullRequestByIndex by validate index > 1

Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
pricly-yellow 2021-10-06 01:16:22 +07:00 committed by GitHub
parent 28971c7c15
commit 6995be66e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 18 deletions

View file

@ -133,6 +133,10 @@ func TestGetPullRequestByIndex(t *testing.T) {
_, err = GetPullRequestByIndex(9223372036854775807, 9223372036854775807)
assert.Error(t, err)
assert.True(t, IsErrPullRequestNotExist(err))
_, err = GetPullRequestByIndex(1, 0)
assert.Error(t, err)
assert.True(t, IsErrPullRequestNotExist(err))
}
func TestGetPullRequestByID(t *testing.T) {