diff options
author | Felipe Artur <felipefac@gmail.com> | 2019-08-05 23:52:38 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2019-08-07 21:39:48 +0300 |
commit | 831ceea92429708c2621e31d076d57a13a712b41 (patch) | |
tree | 551061f77c086ffa4f498f382d594c706aaff215 /spec | |
parent | b82931359b5f9656d739bfbb600438ddf2213ce0 (diff) |
Prevent rewritting plain links as embedded
Prevents rewritting plain image/video links as embedded when moving
issues.
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 |