Follow up of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8982.
EE: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4790
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/26848