Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9d9618fc
Commit
9d9618fc
authored
Oct 31, 2021
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow relative WebP image embed in markdown
Changelog: fixed
parent
817d5d87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
lib/gitlab/blob_helper.rb
lib/gitlab/blob_helper.rb
+1
-1
spec/lib/gitlab/blob_helper_spec.rb
spec/lib/gitlab/blob_helper_spec.rb
+10
-2
No files found.
lib/gitlab/blob_helper.rb
View file @
9d9618fc
...
...
@@ -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.
...
...
spec/lib/gitlab/blob_helper_spec.rb
View file @
9d9618fc
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment