Commit 062c7a30 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix/import-controller-error' into 'master'

Fixes 404 redirect after validation fails importing a project

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19558

See merge request !5143
parents 3c89a788 f6798462
Pipeline #3666169 passed with stages
in 1129 minutes and 29 seconds
......@@ -48,6 +48,7 @@ v 8.10.0 (unreleased)
- Allow '?', or '&' for label names
- Fix importer for GitHub Pull Requests when a branch was reused across Pull Requests
- Add date when user joined the team on the member page
- Fix 404 redirect after validation fails importing a GitLab project
v 8.9.5
- Add more debug info to import/export and memory killer. !5108
......
......@@ -27,10 +27,7 @@ class Import::GitlabProjectsController < Import::BaseController
notice: "Project '#{@project.name}' is being imported."
)
else
redirect_to(
new_import_gitlab_project_path,
alert: "Project could not be imported: #{@project.errors.full_messages.join(', ')}"
)
redirect_back_or_default(options: { alert: "Project could not be imported: #{@project.errors.full_messages.join(', ')}" })
end
end
......
......@@ -42,6 +42,23 @@ feature 'project import', feature: true, js: true do
expect(project.import_status).to eq('finished')
end
scenario 'invalid project' do
project = create(:project, namespace_id: 2)
visit new_project_path
select2('2', from: '#project_namespace_id')
fill_in :project_path, with: project.name, visible: true
click_link 'GitLab export'
attach_file('file', file)
click_on 'Import project'
page.within('.flash-container') do
expect(page).to have_content('Project could not be imported')
end
end
def wiki_exists?
wiki = ProjectWiki.new(project)
File.exist?(wiki.repository.path_to_repo) && !wiki.repository.empty?
......
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