Commit 535410a9 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'sh-fix-blank-codeowners-ce' into 'master'

Fix 500 error caused by CODEOWNERS with no matches

Closes gitlab-ee#10282

See merge request gitlab-org/gitlab-ce!26072
parents 266b4328 5137fce2
---
title: Fix 500 error caused by CODEOWNERS with no matches
merge_request: 26072
author:
type: fixed
......@@ -16,6 +16,7 @@ module Gitlab
def users
return User.none unless @text.present?
return User.none if references.empty?
@users ||= User.from_union(union_relations)
end
......
......@@ -48,6 +48,14 @@ describe Gitlab::UserExtractor do
it 'includes all mentioned usernames' do
expect(extractor.matches[:usernames]).to contain_exactly('user-1', 'user-2', 'user-4')
end
context 'input has no matching e-mail or usernames' do
it 'returns an empty list of users' do
extractor = described_class.new('My test')
expect(extractor.users).to be_empty
end
end
end
describe '#references' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment