summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/filter/asset_proxy_filter_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-01 12:13:38 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-01 12:13:38 +0000
commit5dbeb2d1625c3dcd46a67220ddce250d9bc3f7bd (patch)
treeb4427ac8219ace181f45fde70e818a0240bd24e0 /spec/lib/banzai/filter/asset_proxy_filter_spec.rb
parentc14adba064aa86114dc43cae657212a4b19d6189 (diff)
downloadgitlab-ce-5dbeb2d1625c3dcd46a67220ddce250d9bc3f7bd.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'spec/lib/banzai/filter/asset_proxy_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/asset_proxy_filter_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/asset_proxy_filter_spec.rb b/spec/lib/banzai/filter/asset_proxy_filter_spec.rb
index 004c70c28f1..dc6ac52a8c2 100644
--- a/spec/lib/banzai/filter/asset_proxy_filter_spec.rb
+++ b/spec/lib/banzai/filter/asset_proxy_filter_spec.rb
@@ -80,6 +80,15 @@ RSpec.describe Banzai::Filter::AssetProxyFilter, feature_category: :team_plannin
expect(doc.at_css('img')['data-canonical-src']).to eq src
end
+ it 'replaces invalid URLs' do
+ src = '///example.com/test.png'
+ new_src = 'https://assets.example.com/3368d2c7b9bed775bdd1e811f36a4b80a0dcd8ab/2f2f2f6578616d706c652e636f6d2f746573742e706e67'
+ doc = filter(image(src), @context)
+
+ expect(doc.at_css('img')['src']).to eq new_src
+ expect(doc.at_css('img')['data-canonical-src']).to eq src
+ end
+
it 'skips internal images' do
src = "#{Gitlab.config.gitlab.url}/test.png"
doc = filter(image(src), @context)