pulibrary / orangelight

PUL Blacklight Project (Ruby 3.1.0, Rails 7.1.4)
21 stars 7 forks source link

export_as_mla_citation_txt encounters a nilClass on production #3938

Open regineheberlein opened 10 months ago

regineheberlein commented 10 months ago

Expected behavior

A record can be exported in MLA format

Actual behavior

It serves the "Looks like something went wrong!" error page and reports NoMethodError: undefined method `+' for nil:NilClass return temp_name.last + " " + temp_name.first

Steps to replicate

https://catalog.princeton.edu/catalog/99126151309006421/citation

Impact of this bug

Patrons cannot export citations in MLA format

Honeybadger link and code snippet, if applicable

Honeybadger report


NoMethodError: undefined method `+' for nil:NilClass return temp_name.last + " " + temp_name.first ^
    return name unless name =~ /,/
    temp_name = name.split(", ")
    return temp_name.last + " " + temp_name.first
  end
end```

### Implementation notes, if any
sandbergja commented 9 months ago

I believe this happens because the record has a 700$a subfield with the content , . (comma space period).

The fix would likely be in this file in the blacklight-marc gem, with a test perhaps in this file

sandbergja commented 9 months ago

This will be resolved upstream by https://github.com/projectblacklight/blacklight-marc/pull/117

sandbergja commented 8 months ago

The fix is now in blacklight-marc 8.1.2, we just need to upgrade and test to resolve this issue.