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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1faaf6ff
Commit
1faaf6ff
authored
Jan 04, 2018
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 500 when visiting a commit where blobs do not exist (nil blobs)
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/41491
parent
65b04860
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
4 deletions
+33
-4
app/assets/stylesheets/pages/diff.scss
app/assets/stylesheets/pages/diff.scss
+7
-1
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+1
-1
app/views/projects/diffs/_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+6
-1
changelogs/unreleased/41491-fix-nil-blob-name-error.yml
changelogs/unreleased/41491-fix-nil-blob-name-error.yml
+5
-0
spec/features/projects/commits/user_browses_commits_spec.rb
spec/features/projects/commits/user_browses_commits_spec.rb
+14
-1
No files found.
app/assets/stylesheets/pages/diff.scss
View file @
1faaf6ff
...
...
@@ -651,12 +651,18 @@
min-width
:
0
;
}
.diff-changed-file-name
{
.diff-changed-file-name
,
.diff-changed-blank-file-name
{
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.diff-changed-blank-file-name
{
color
:
$gl-text-color-tertiary
;
font-style
:
italic
;
}
.diff-changed-file-path
{
color
:
$gl-text-color-tertiary
;
}
...
...
app/views/projects/diffs/_file.html.haml
View file @
1faaf6ff
...
...
@@ -11,7 +11,7 @@
-
unless
diff_file
.
submodule?
-
blob
=
diff_file
.
blob
.file-actions.hidden-xs
-
if
blob
.
readable_text?
-
if
blob
&
.
readable_text?
=
link_to
'#'
,
class:
'js-toggle-diff-comments btn active has-tooltip'
,
title:
"Toggle comments for this file"
,
disabled:
@diff_notes_disabled
do
=
icon
(
'comment'
)
\
...
...
app/views/projects/diffs/_stats.html.haml
View file @
1faaf6ff
...
...
@@ -24,7 +24,12 @@
%a
.diff-changed-file
{
href:
"##{hexdigest(diff_file.file_path)}"
,
title:
diff_file
.
new_path
}
=
sprite_icon
(
diff_file_changed_icon
(
diff_file
),
size:
16
,
css_class:
"
#{
diff_file_changed_icon_color
(
diff_file
)
}
diff-file-changed-icon append-right-8"
)
%span
.diff-changed-file-content.append-right-8
%strong
.diff-changed-file-name
=
diff_file
.
blob
.
name
-
if
diff_file
.
blob
&
.
name
%strong
.diff-changed-file-name
=
diff_file
.
blob
.
name
-
else
%strong
.diff-changed-blank-file-name
=
s_
(
'Diffs|No file name available'
)
%span
.diff-changed-file-path.prepend-top-5
=
diff_file_path_text
(
diff_file
)
%span
.diff-changed-stats
%span
.cgreen
<
...
...
changelogs/unreleased/41491-fix-nil-blob-name-error.yml
0 → 100644
View file @
1faaf6ff
---
title
:
Fix 500 error when visiting a commit where the blobs do not exist
merge_request
:
author
:
type
:
fixed
spec/features/projects/commits/user_browses_commits_spec.rb
View file @
1faaf6ff
require
'spec_helper'
describe
'User brow
e
ses commits'
do
describe
'User browses commits'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
...
...
@@ -31,6 +31,19 @@ describe 'User broweses commits' do
check_author_link
(
RepoHelpers
.
sample_commit
.
author_email
,
user
)
end
end
context
'when the blob does not exist'
do
let
(
:commit
)
{
create
(
:commit
,
project:
project
)
}
it
'shows a blank label'
do
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:blob
).
and_return
(
nil
)
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:raw_binary?
).
and_return
(
true
)
visit
(
project_commit_path
(
project
,
commit
))
expect
(
find
(
'.diff-file-changes'
,
visible:
false
)).
to
have_content
(
'No file name available'
)
end
end
end
private
...
...
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