summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--config/routes/user.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 1aa22995692..6a881b271d7 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -86,7 +86,7 @@ class UsersController < ApplicationController
end
def exists
- render json: { exists: !Namespace.where(name: params[:username]).nil? }
+ render json: { exists: Namespace.where(path: params[:username].downcase).any? }
end
private
diff --git a/config/routes/user.rb b/config/routes/user.rb
index 54bbcb18f6a..dfb5d2a2ba4 100644
--- a/config/routes/user.rb
+++ b/config/routes/user.rb
@@ -33,5 +33,6 @@ scope(path: 'u/:username',
get :projects
get :contributed, as: :contributed_projects
get :snippets
+ get :exists
get '/', to: redirect('/%{username}')
end