Project

General

Profile

Actions

Defect #37157

closed

Internal server error when trying to retrieve AnonymousUser's information via Users API

Added by Go MAEDA almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Users API raises an exception when it attempts to generate an avatar URL for AnonymousUser. This was originally reported in #36303#note-8 by Alex Moroz.

Started GET "/users/6.json" for 127.0.0.1 at 2022-05-25 09:41:36 +0900
Processing by UsersController#show as JSON
  Parameters: {"id"=>"6"}
 .
(snip)
 .
  Rendering users/show.api.rsb
  Rendered users/show.api.rsb (Duration: 0.5ms | Allocations: 200)
Completed 500 Internal Server Error in 15ms (ActiveRecord: 1.9ms | Allocations: 7193)

ActionView::Template::Error (no implicit conversion of nil into String):
     9:   api.updated_on @user.updated_on
    10:   api.last_login_on     @user.last_login_on
    11:   api.passwd_changed_on @user.passwd_changed_on
    12:   api.avatar_url gravatar_url(@user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
    13:   api.twofa_scheme      @user.twofa_scheme if User.current.admin? || (User.current == @user)
    14:   api.api_key    @user.api_key if User.current.admin? || (User.current == @user)
    15:   api.status     @user.status if User.current.admin?

lib/plugins/gravatar/lib/gravatar.rb:68:in `digest'
lib/plugins/gravatar/lib/gravatar.rb:68:in `hexdigest'
lib/plugins/gravatar/lib/gravatar.rb:68:in `gravatar_url'
app/views/users/show.api.rsb:12
lib/redmine/views/builders/structure.rb:73:in `method_missing'
app/views/users/show.api.rsb:1
lib/redmine/views/builders.rb:38:in `for'
app/views/users/show.api.rsb:1
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Files

37157.patch (1.91 KB) 37157.patch Yuichi HARADA, 2022-05-26 06:48

Related issues

Related to Redmine - Feature #36303: Include avatar URL in Users APIClosedGo MAEDA

Actions
Actions

Also available in: Atom PDF