Renamed files in MR Diffs are triggering an error on console
Summary
When you have an MR with a renamed file with changes, there's an error message in the console:
Example: andr3/meet.andr3.net!24 (diffs)
vue.esm.js:1897 TypeError: Cannot read property 'name' of null
at a.canLoadFullDiff (renamed.vue:48)
at gn.get (vue.esm.js:4488)
at gn.evaluate (vue.esm.js:4593)
at a.canLoadFullDiff (vue.esm.js:4845)
at a.<anonymous> (renamed.vue?1ed6:1)
at a.t._render (vue.esm.js:3557)
at a.r (vue.esm.js:4075)
at gn.get (vue.esm.js:4488)
at new gn (vue.esm.js:4477)
at vue.esm.js:4082
computed: {
shortSha() {
return truncateSha(this.diffFile.content_sha);
},
canLoadFullDiff() {
return this.diffFile.alternate_viewer.name === 'text';
},
in vue_shared/components/diff_viewer/viewers/renamed.vue
Steps to reproduce
- Load an MR with a renamed file with changes.
- Check the console.
Example Project
andr3/meet.andr3.net!24 (diffs)
What is the current bug behavior?
Nothing seems to break, but an error message is displayed.
What is the expected correct behavior?
No error message displayed.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Edited by André Luís