Commit 56538f9c authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix/unexistent-group-500' into 'master'

Return a 404 instead of a 500 when accessing a non-existent group

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

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

See merge request !2614
parents 4dea2682 afde800b
...@@ -8,6 +8,7 @@ v 8.5.0 (unreleased) ...@@ -8,6 +8,7 @@ v 8.5.0 (unreleased)
- Fix diff comments loaded by AJAX to load comment with diff in discussion tab - Fix diff comments loaded by AJAX to load comment with diff in discussion tab
- Whitelist raw "abbr" elements when parsing Markdown (Benedict Etzel) - Whitelist raw "abbr" elements when parsing Markdown (Benedict Etzel)
- Don't vendor minified JS - Don't vendor minified JS
- Display 404 error on group not found
- Track project import failure - Track project import failure
- Fix visibility level text in admin area (Zeger-Jan van de Weg) - Fix visibility level text in admin area (Zeger-Jan van de Weg)
- Update the ExternalIssue regex pattern (Blake Hitchcock) - Update the ExternalIssue regex pattern (Blake Hitchcock)
......
...@@ -82,6 +82,7 @@ class GroupsController < Groups::ApplicationController ...@@ -82,6 +82,7 @@ class GroupsController < Groups::ApplicationController
def group def group
@group ||= Group.find_by(path: params[:id]) @group ||= Group.find_by(path: params[:id])
@group || render_404
end end
def load_projects def load_projects
......
...@@ -3,6 +3,10 @@ Feature: Groups ...@@ -3,6 +3,10 @@ Feature: Groups
Given I sign in as "John Doe" Given I sign in as "John Doe"
And "John Doe" is owner of group "Owned" And "John Doe" is owner of group "Owned"
Scenario: I should not see a group if it does not exist
When I visit group "NonExistentGroup" page
Then page status code should be 404
Scenario: I should have back to group button Scenario: I should have back to group button
When I visit group "Owned" page When I visit group "Owned" page
Then I should see back to dashboard button Then I should see back to dashboard button
......
...@@ -120,6 +120,10 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -120,6 +120,10 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived') expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
end end
step 'I visit group "NonExistentGroup" page' do
visit group_path(-1)
end
private private
def assigned_to_me(key) def assigned_to_me(key)
......
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