Commit e9c896b3 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'sh-fix-no-metthod-failure-reply-by-email' into 'master'

Handle invalid project ID in reply-by-email

See merge request gitlab-org/gitlab!62530
parents bae27142 da6bd2eb
...@@ -84,6 +84,8 @@ module Gitlab ...@@ -84,6 +84,8 @@ module Gitlab
end end
def valid_project_slug?(found_project) def valid_project_slug?(found_project)
return false unless found_project
project_slug == found_project.full_path_slug project_slug == found_project.full_path_slug
end end
......
...@@ -128,6 +128,14 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do ...@@ -128,6 +128,14 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound) expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound)
end end
end end
context 'when project ID is invalid' do
it 'raises a ProjectNotFound' do
handler = described_class.new(email_raw, "gitlabhq-gitlabhq-#{Gitlab::Database::MAX_INT_VALUE}-#{user.incoming_email_token}-issue")
expect { handler.execute }.to raise_error(Gitlab::Email::ProjectNotFound)
end
end
end end
def email_fixture(path) def email_fixture(path)
......
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