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
972775f4
Commit
972775f4
authored
Jan 06, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove file type checking for diff viewers
parent
1f32e55e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
30 deletions
+1
-30
app/models/diff_viewer/base.rb
app/models/diff_viewer/base.rb
+1
-2
spec/models/diff_viewer/base_spec.rb
spec/models/diff_viewer/base_spec.rb
+0
-28
No files found.
app/models/diff_viewer/base.rb
View file @
972775f4
...
...
@@ -4,7 +4,7 @@ module DiffViewer
class
Base
PARTIAL_PATH_PREFIX
=
'projects/diffs/viewers'
class_attribute
:partial_name
,
:type
,
:extensions
,
:
file_types
,
:
binary
,
:switcher_icon
,
:switcher_title
class_attribute
:partial_name
,
:type
,
:extensions
,
:binary
,
:switcher_icon
,
:switcher_title
# These limits relate to the sum of the old and new blob sizes.
# Limits related to the actual size of the diff are enforced in Gitlab::Diff::File.
...
...
@@ -50,7 +50,6 @@ module DiffViewer
return
true
if
blob
.
nil?
return
false
if
verify_binary
&&
binary?
!=
blob
.
binary_in_repo?
return
true
if
extensions
&
.
include?
(
blob
.
extension
)
return
true
if
file_types
&
.
include?
(
blob
.
file_type
)
false
end
...
...
spec/models/diff_viewer/base_spec.rb
View file @
972775f4
...
...
@@ -43,34 +43,6 @@ describe DiffViewer::Base do
end
end
context
'when the file type is supported'
do
let
(
:commit
)
{
project
.
commit
(
'1a0b36b3cdad1d2ee32457c102a8c0b7056fa863'
)
}
let
(
:diff_file
)
{
commit
.
diffs
.
diff_file_with_new_path
(
'LICENSE'
)
}
before
do
viewer_class
.
file_types
=
%i(license)
viewer_class
.
binary
=
false
end
context
'when the binaryness matches'
do
it
'returns true'
do
expect
(
viewer_class
.
can_render?
(
diff_file
)).
to
be_truthy
end
end
context
'when the binaryness does not match'
do
before
do
allow_next_instance_of
(
Blob
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:binary_in_repo?
).
and_return
(
true
)
end
end
it
'returns false'
do
expect
(
viewer_class
.
can_render?
(
diff_file
)).
to
be_falsey
end
end
end
context
'when the extension and file type are not supported'
do
it
'returns false'
do
expect
(
viewer_class
.
can_render?
(
diff_file
)).
to
be_falsey
...
...
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