From b0498c176fa134761d899c9b369be12f1ca789c5 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 22 May 2017 20:08:33 -0500 Subject: Remove changes that are not absolutely necessary --- lib/constraints/group_url_constrainer.rb | 6 +++--- lib/constraints/project_url_constrainer.rb | 2 +- lib/constraints/user_url_constrainer.rb | 6 +----- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/constraints') diff --git a/lib/constraints/group_url_constrainer.rb b/lib/constraints/group_url_constrainer.rb index 6fc1d56d7a0..0ea2f97352d 100644 --- a/lib/constraints/group_url_constrainer.rb +++ b/lib/constraints/group_url_constrainer.rb @@ -1,9 +1,9 @@ class GroupUrlConstrainer def matches?(request) - full_path = request.params[:group_id] || request.params[:id] + id = request.params[:group_id] || request.params[:id] - return false unless DynamicPathValidator.valid_group_path?(full_path) + return false unless DynamicPathValidator.valid_namespace_path?(id) - Group.find_by_full_path(full_path, follow_redirects: request.get?).present? + Group.find_by_full_path(id, follow_redirects: request.get?).present? end end diff --git a/lib/constraints/project_url_constrainer.rb b/lib/constraints/project_url_constrainer.rb index 4c0aee6c48f..4444a1abee3 100644 --- a/lib/constraints/project_url_constrainer.rb +++ b/lib/constraints/project_url_constrainer.rb @@ -2,7 +2,7 @@ class ProjectUrlConstrainer def matches?(request) namespace_path = request.params[:namespace_id] project_path = request.params[:project_id] || request.params[:id] - full_path = [namespace_path, project_path].join('/') + full_path = namespace_path + '/' + project_path return false unless DynamicPathValidator.valid_project_path?(full_path) diff --git a/lib/constraints/user_url_constrainer.rb b/lib/constraints/user_url_constrainer.rb index d16ae7f3f40..28159dc0dec 100644 --- a/lib/constraints/user_url_constrainer.rb +++ b/lib/constraints/user_url_constrainer.rb @@ -1,9 +1,5 @@ class UserUrlConstrainer def matches?(request) - full_path = request.params[:username] - - return false unless DynamicPathValidator.valid_user_path?(full_path) - - User.find_by_full_path(full_path, follow_redirects: request.get?).present? + User.find_by_full_path(request.params[:username], follow_redirects: request.get?).present? end end -- cgit v1.2.3