Both opac-detail and opac-ISBDdetail check if biblio can be found and redirect if not found. opac-MARCdetail just crashes. Since it first tries to retrieve metadata. Easy fix.
Created attachment 158518 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 158576 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com>
I tried without the patch, but got the 404 - can you please check? http://localhost:8080/cgi-bin/koha/opac-MARCdetail?biblionumber=11111199999
I still see: Can't call method "metadata" on an undefined value at /usr/share/koha/opac/opac-MARCdetail.pl line 95 You need to restart Plack. And perhaps clear the browser cache?
This is how I tested (using KTD): 1. In the OPAC, attempt to view a record that does not exist - normal view: . http://127.0.0.1:8080/cgi-bin/koha/opac-detail.pl?biblionumber=9999 => redirected to the 404 page 2. In the OPAC, attempt to view a record that does not exist - ISBD view: . 127.0.0.1:8080/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=9999 => redirected to the 404 page 3. In the OPAC, attempt to view a record that does not exist - MARC view: . 127.0.0.1:8080/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=9999 => Get an error trace: Can't call method "metadata" on an undefined value at /kohadevbox/koha/opac/opac-MARCdetail.pl line 95 .... 4. Apply the patch, restart_all, fresh browser (cache cleared). 5. Repeat step 3 => now redirected to the 404 page, no error trace
(In reply to Katrin Fischer from comment #3) > I tried without the patch, but got the 404 - can you please check? > > http://localhost:8080/cgi-bin/koha/opac-MARCdetail?biblionumber=11111199999 This URL ↑↑ goes to opac-MARCdetail but it should be opac-MARCdetail.pl
Created attachment 158977 [details] [review] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> JD amended patch: Use ternary op Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.06