diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2018-01-10 19:24:24 +0000 |
---|---|---|
committer | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2018-01-10 19:24:24 +0000 |
commit | ab28ea071ba7f70e59e8aeba9da03031dd83b0f1 (patch) | |
tree | 577a9044d8c73a1f667c05c6d7a2e9b0ddf4aa17 /app/views | |
parent | 4fc0a0901791cd385e38fb437d167e65847fb015 (diff) | |
parent | 1faaf6ffbc7ccf8dd12245a7003de9d91088d11c (diff) | |
download | gitlab-ce-ab28ea071ba7f70e59e8aeba9da03031dd83b0f1.tar.gz |
Merge branch '41491-fix-nil-blob-name-error' into 'master'
Fix 500 error when visiting a commit where the blobs do not exist (nil blobs)
Closes #41491
See merge request gitlab-org/gitlab-ce!16237
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/diffs/_file.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/diffs/_stats.html.haml | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index adc4dcbed33..0b01e38d23d 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -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') \ diff --git a/app/views/projects/diffs/_stats.html.haml b/app/views/projects/diffs/_stats.html.haml index 325159dd9a7..b082ad0ef0e 100644 --- a/app/views/projects/diffs/_stats.html.haml +++ b/app/views/projects/diffs/_stats.html.haml @@ -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< |