summaryrefslogtreecommitdiff
path: root/app/views/projects
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-11-15 10:22:36 +0000
committerDouwe Maan <douwe@gitlab.com>2016-11-15 10:22:36 +0000
commitfdd7e3f6e93e02adacf283071f88e3284449bb3a (patch)
tree15dfe31354e0d63cfa5001a797613bcb13391fa0 /app/views/projects
parent3a3b06b4faccaf49279bee397af6df2916a9195e (diff)
parent0f61bb2dc5298a7e06f8e211adcf46dd282b9c86 (diff)
downloadgitlab-ce-fdd7e3f6e93e02adacf283071f88e3284449bb3a.tar.gz
Merge branch 'stanhu/gitlab-ce-fix-error-500-with-mr-images' into 'master'
Fix Error 500 when creating a merge request that contains an image that was deleted and added _Originally opened at !4816 by @stanhu._ - - - ## What does this MR do? This MR fixes an Error 500 when creating a merge request that contains an image that was deleted and added. Before, when displaying the before and after image, the code would always retrieve the image from the parent commit. However, in a diff, this could cause two different problems: The "before" image may not actually be the image you want to compare against (regression of #14327) It may appear as though a file was modified when it was really just added during the diff ## Are there points in the code the reviewer needs to double check? There may be a more elegant to fix this bug. ## What are the relevant issue numbers? Closes #3893, gitlab-org/gitlab-ee#678 See merge request !7457
Diffstat (limited to 'app/views/projects')
-rw-r--r--app/views/projects/diffs/_content.html.haml2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml
index c3d2f80544b..6120b2191dd 100644
--- a/app/views/projects/diffs/_content.html.haml
+++ b/app/views/projects/diffs/_content.html.haml
@@ -25,7 +25,7 @@
- elsif diff_file.renamed_file
.nothing-here-block File moved
- elsif blob.image?
- - old_blob = diff_file.old_blob(diff_commit)
+ - old_blob = diff_file.old_blob(diff_file.old_content_commit || @base_commit)
= render "projects/diffs/image", diff_file: diff_file, old_file: old_blob, file: blob
- else
.nothing-here-block No preview for this file type