Fix of `Commit search breaks for some URLs on gitlab-ce project`

Merged Valery Sizov requested to merge es_fix_500 into master