diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-08-09 23:41:12 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-08-09 23:41:12 +0300 |
commit | 4b10592b8161df6fc323274bd36c84d3eac258c4 (patch) | |
tree | 1450600fe327cb6f72aea493155421eeb449a426 /spec | |
parent | 37dd2aead8fcab36d93301932a2415fd0d186f5d (diff) | |
parent | 831ceea92429708c2621e31d076d57a13a712b41 (diff) |
Merge branch 'issue_58494' into 'master'
Prevent rewritting plain links as embedded
Closes #58494
See merge request gitlab-org/gitlab-ce!31489
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/gfm/uploads_rewriter_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb index ef52a25f47e..d24f5c45107 100644 --- a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb +++ b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb @@ -55,6 +55,17 @@ describe Gitlab::Gfm::UploadsRewriter do end end + it 'does not rewrite plain links as embedded' do + embedded_link = image_uploader.markdown_link + plain_image_link = embedded_link.sub(/\A!/, "") + text = "#{plain_image_link} and #{embedded_link}" + + moved_text = described_class.new(text, old_project, user).rewrite(new_project) + + expect(moved_text.scan(/!\[.*?\]/).count).to eq(1) + expect(moved_text.scan(/\A\[.*?\]/).count).to eq(1) + end + context "file are stored locally" do include_examples "files are accessible" end |