diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-08-01 02:53:33 +0800 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-08-02 06:34:20 +0800 |
commit | 3b1da9be250560c9a2e4ca69c6fa89e8b36f01e1 (patch) | |
tree | 96ba5c71cce6ab6a15f2e7f61b155f44f27adab0 | |
parent | 52b857f119debb5a03c216c4199eb21a49d815b6 (diff) | |
download | gitlab-ce-17276-breakage-in-displaying-svg-in-the-same-repository.tar.gz |
Fix inline rendering of SVGs from current repo17276-breakage-in-displaying-svg-in-the-same-repository
Changes generated URL to raw instead of blob
-rw-r--r-- | changelogs/unreleased/17276-breakage-in-displaying-svg-in-the-same-repository.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/blob_helper.rb | 2 | ||||
-rw-r--r-- | spec/models/commit_spec.rb | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/changelogs/unreleased/17276-breakage-in-displaying-svg-in-the-same-repository.yml b/changelogs/unreleased/17276-breakage-in-displaying-svg-in-the-same-repository.yml new file mode 100644 index 00000000000..93936d441e7 --- /dev/null +++ b/changelogs/unreleased/17276-breakage-in-displaying-svg-in-the-same-repository.yml @@ -0,0 +1,5 @@ +--- +title: Fix inline rendering of relative paths to SVGs from the current repository +merge_request: 31352 +author: +type: fixed diff --git a/lib/gitlab/blob_helper.rb b/lib/gitlab/blob_helper.rb index d3e15a79a8b..fc579ad8d2a 100644 --- a/lib/gitlab/blob_helper.rb +++ b/lib/gitlab/blob_helper.rb @@ -45,7 +45,7 @@ module Gitlab end def image? - ['.png', '.jpg', '.jpeg', '.gif'].include?(extname.downcase) + ['.png', '.jpg', '.jpeg', '.gif', '.svg'].include?(extname.downcase) end # Internal: Lookup mime type for extension. diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index e76186fb280..7b35c2ffd36 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -556,6 +556,7 @@ eos it 'returns the URI type at the given path' do expect(commit.uri_type('files/html')).to be(:tree) expect(commit.uri_type('files/images/logo-black.png')).to be(:raw) + expect(commit.uri_type('files/images/wm.svg')).to be(:raw) expect(project.commit('video').uri_type('files/videos/intro.mp4')).to be(:raw) expect(commit.uri_type('files/js/application.js')).to be(:blob) end |