diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-23 10:19:57 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-23 10:21:12 +0300 |
commit | 0faf772b6cfd691e16d529051a8901627a660a7a (patch) | |
tree | 3e890ddd4c2bf3fdd2fccd95e9ebc981941514eb /spec/lib/banzai | |
parent | 46be07d2c1da93cffd59fb03036e357c04ff6f3b (diff) |
Gracefully handle garbled URIs in Markdown
There are certain inputs that look like valid URIs that are accepted by URI
but not Addressable::URI. Handle the case where the latter fails.
Closes #41442
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r-- | spec/lib/banzai/filter/relative_link_filter_spec.rb | 5 |
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 ef306f1cd4a..f38f0776303 100644 --- a/spec/lib/banzai/filter/relative_link_filter_spec.rb +++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb @@ -76,6 +76,11 @@ describe Banzai::Filter::RelativeLinkFilter do expect { filter(act) }.not_to raise_error end + it 'does not raise an exception with a garbled path' do + act = link("open(/var/tmp/):%20/location%0Afrom:%20/test") + 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']) |