aboutsummaryrefslogtreecommitdiffstats
path: root/models/pull_test.go
diff options
context:
space:
mode:
authorpricly-yellow <79628427+pricly-yellow@users.noreply.github.com>2021-10-05 21:41:48 +0700
committerGitHub <noreply@github.com>2021-10-05 16:41:48 +0200
commit20eaca6d05ddeb56f5a76638e84211117c3f0131 (patch)
treee9ff51b835b58bcab4efd9cffd20cd720170b0cd /models/pull_test.go
parentf4ea6cc4b479de70ac2e82330f1a0d515f7fd50f (diff)
downloadgitea-20eaca6d05ddeb56f5a76638e84211117c3f0131.tar.gz
gitea-20eaca6d05ddeb56f5a76638e84211117c3f0131.zip
Fix stange behavior of DownloadPullDiffOrPatch in incorect index (#17223)
Fix GetPullRequestByIndex by validate index > 1 Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de> Co-authored-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'models/pull_test.go')
-rw-r--r--models/pull_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/pull_test.go b/models/pull_test.go
index 2b7ef2f664..173977aafe 100644
--- a/models/pull_test.go
+++ b/models/pull_test.go
@@ -134,6 +134,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) {