Skip to content

Commit

Permalink
[ci] Fix redirect when target project of submit request does not exist
Browse files Browse the repository at this point in the history
When the target project does not exist we can not redirect to it. In
that case we either redirect back or to the main page.
  • Loading branch information
bgeuken committed May 4, 2017
1 parent 5eaaad2 commit e6c0195
Show file tree
Hide file tree
Showing 6 changed files with 846 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/api/app/controllers/webui/package_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def submit_request
rescue Project::UnknownObjectError,
BsRequestAction::UnknownProject,
BsRequestAction::UnknownTargetPackage => e
flash[:error] = "Unable to submit (missing target): #{e.message}"
redirect_back(fallback_location: root_path, error: "Unable to submit (missing target): #{e.message}")
return
rescue APIException, ActiveRecord::RecordInvalid => e
flash[:error] = "Unable to submit: #{e.message}"
rescue ActiveRecord::RecordInvalid => e
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6c0195

Please sign in to comment.