summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/filter/issue_reference_filter_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-06-18 10:55:45 -0700
committerStan Hu <stanhu@gmail.com>2016-06-18 13:07:38 -0700
commit7c9eba891963451a1feb2e5bbef90fdcac1496ff (patch)
tree51692ed3b138406a8d0bc740eb259076e91e4361 /spec/lib/banzai/filter/issue_reference_filter_spec.rb
parent00906b5bb6cde8cb60281109060a519a54000c61 (diff)
downloadgitlab-ce-7c9eba891963451a1feb2e5bbef90fdcac1496ff.tar.gz
Fix RangeError exceptions when referring to issues or merge requests outside of max database values
When using #XYZ in Markdown text, if XYZ exceeds the maximum value of a signed 32-bit integer, we get an exception when the Markdown render attempts to run `where(iids: XYZ)`. Introduce a method that will throw out out-of-bounds values. Closes #18777
Diffstat (limited to 'spec/lib/banzai/filter/issue_reference_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/issue_reference_filter_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/issue_reference_filter_spec.rb b/spec/lib/banzai/filter/issue_reference_filter_spec.rb
index 25f0bc2092f..5b63c946114 100644
--- a/spec/lib/banzai/filter/issue_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/issue_reference_filter_spec.rb
@@ -134,6 +134,12 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
expect(reference_filter(act).to_html).to eq exp
end
+
+ it 'ignores out-of-bounds issue IDs on the referenced project' do
+ exp = act = "Fixed ##{Gitlab::Database::MAX_INT_VALUE + 1}"
+
+ expect(reference_filter(act).to_html).to eq exp
+ end
end
context 'cross-project URL reference' do