We're updating the issue view to help you get more done.Learn more

500 error if attempting to go to the works page for a pseud for a user that does not exist

Steps to reproduce

  1. Make up a username that does not exist, e.g. notsarken, and attempt to access the works pages for one of its pseuds, e.g.

    https://test.archiveofourown.org/users/notsarken/pseuds/notsarken/works

What happens

A 500 error

What should happen instead

A 404 error

Notes

There are constantly about 10 million of these errors in New Relic. The relevant bit of the error:

1 2 3 4 5 Error message NoMethodError: undefined method `pseuds' for nil:NilClass Sample stack trace (show Rails) …ses/20180611183634/app/controllers/works_controller.rb:801:in `load_owner'

Relevant line(s) of code:

1 2 3 4 5 6 if params[:user_id].present? @user= User.find_by(login: params[:user_id]) if params[:pseud_id].present? @pseud= @user.pseuds.find_by(name: params[:pseud_id]) end end

The error doesn't happen if you try to go to the works page for a nonexistent pseud for an existing user, e.g. https://test.archiveofourown.org/users/sarken/pseuds/fakepseud/works. If you do that, it just takes you to the user's works page.

Status

Assignee

Sarken

Reporter

Sarken

Roadmap

Users
Pseuds

Priority

Medium

Affects versions

0.9.214

Fix versions

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9