summaryrefslogtreecommitdiff
path: root/spec/lib/banzai
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-29 07:23:39 -0400
committerStan Hu <stanhu@gmail.com>2018-09-29 07:25:50 -0400
commitc92372e896959d682dc70454a00f47672ca3bb9d (patch)
tree2d84d890e5b160b39c7887ba617bfe7f1db0ddfa /spec/lib/banzai
parentd924176117f3cc73f539ed90b47e1912a3478cf0 (diff)
downloadgitlab-ce-c92372e896959d682dc70454a00f47672ca3bb9d.tar.gz
Prevent Error 500s with invalid relative links
https://gitlab.com/gitlab-org/gitlab-ce/issues/52009
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r--spec/lib/banzai/filter/relative_link_filter_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/relative_link_filter_spec.rb b/spec/lib/banzai/filter/relative_link_filter_spec.rb
index ba8dc68ceda..ed1ebe9ebf6 100644
--- a/spec/lib/banzai/filter/relative_link_filter_spec.rb
+++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb
@@ -83,6 +83,11 @@ describe Banzai::Filter::RelativeLinkFilter do
expect { filter(act) }.not_to raise_error
end
+ it 'does not raise an exception with a space in the path' do
+ act = link("/uploads/d18213acd3732630991986120e167e3d/Landscape_8.jpg \nBut here's some more unexpected text :smile:)")
+ expect { filter(act) }.not_to raise_error
+ end
+
it 'ignores ref if commit is passed' do
doc = filter(link('non/existent.file'), commit: project.commit('empty-branch') )
expect(doc.at_css('a')['href'])