Commit 9d9618fc authored by Kev's avatar Kev

Allow relative WebP image embed in markdown

Changelog: fixed
parent 817d5d87
......@@ -47,7 +47,7 @@ module Gitlab
end
def image?
['.png', '.jpg', '.jpeg', '.gif', '.svg'].include?(extname.downcase)
['.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp'].include?(extname.downcase)
end
# Internal: Lookup mime type for extension.
......
......@@ -7,6 +7,7 @@ RSpec.describe Gitlab::BlobHelper do
let(:project) { create(:project) }
let(:blob) { fake_blob(path: 'file.txt') }
let(:webp_blob) { fake_blob(path: 'file.webp') }
let(:large_blob) { fake_blob(path: 'test.pdf', size: 2.megabytes, binary: true) }
describe '#extname' do
......@@ -62,8 +63,15 @@ RSpec.describe Gitlab::BlobHelper do
end
describe '#image?' do
it 'returns false' do
expect(blob.image?).to be_falsey
context 'with a .txt file' do
it 'returns false' do
expect(blob.image?).to be_falsey
end
end
context 'with a .webp file' do
it 'returns true' do
expect(webp_blob.image?).to be_truthy
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment