Merge branch 'sh-catch-invalid-uri-markdown' into 'master'
Gracefully handle garbled URIs in Markdown Closes #41442 See merge request gitlab-org/gitlab-ce!16123
This commit is contained in:
commit
29749f92b7
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Gracefully handle garbled URIs in Markdown
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -66,7 +66,7 @@ module Banzai
|
|||
if uri.relative? && uri.path.present?
|
||||
html_attr.value = rebuild_relative_uri(uri).to_s
|
||||
end
|
||||
rescue URI::Error
|
||||
rescue URI::Error, Addressable::URI::InvalidURIError
|
||||
# noop
|
||||
end
|
||||
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue