From dad8fc242c646161b353b5f65ab830ea689ff99e Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 7 Jul 2016 15:34:45 +0200 Subject: fix 404 error, redirect back with flash message --- app/controllers/import/gitlab_projects_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index 513348c39af..30df1fb2fec 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -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 -- cgit v1.2.1 From cf46a88b8da55e015fa3af09f956880a3787bf50 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 7 Jul 2016 15:49:16 +0200 Subject: added changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index bc9bb7747a4..937aefefd99 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 -- cgit v1.2.1 From f67984626b7422e6a110d343860f1079243dab07 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 7 Jul 2016 16:12:28 +0200 Subject: added test --- .../features/projects/import_export/import_file_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 9d66f76ef58..bc3bf53fe9d 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -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? -- cgit v1.2.1