2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

Allow periods in the external_id value used in the /users/by-external route.

This commit is contained in:
Ryan Fox 2015-02-02 12:55:32 -05:00
parent f15b0d205f
commit 1f0915bf83
2 changed files with 9 additions and 1 deletions

View file

@ -28,6 +28,13 @@ class UsersController < ApplicationController
def show
@user = fetch_user_from_params
user_serializer = UserSerializer.new(@user, scope: guardian, root: 'user')
# This is a hack to get around a Rails issue where values with periods aren't handled correctly
# when used as part of a route.
if params[:external_id] and params[:external_id].ends_with? '.json'
return render_json_dump(user_serializer)
end
respond_to do |format|
format.html do
@restrict_fields = guardian.restrict_user_fields?(@user)