archivesspace-plugins / lcnaf

6 stars 3 forks source link

Update to account for id.loc.gov moving from http to https #6

Closed lorawoodford closed 4 years ago

lorawoodford commented 4 years ago

The plugin was checking for a 200 status code and throwing an exception for anything other than a 200. id.loc.gov now throws a 301 for http://id.loc.gov redirecting to https://id.loc.gov. While we can (and have) updated the hardcoded search links in lcnaf_controller, we can't handle the fact that the entry uri's returned by that search also point to now 301'd uris (e.g. http://id.loc.gov/authorities/names/n86828140.marcxml.xml). Just to get things working again, I've added a check for 301/Net::HTTPMovedPermanently before the check for anything other than 200/Net::HTTPOK.

Also, quickly provided better user feedback in the Search Error modal since the Internal Server Error that was getting thrown there was unlikely to ever by helpful to anyone. This can/should be improved upon in the future, but for the time being this at least gets the plugin up and running again.