[Bug 36891] New: Restore returning 404 from svc/bib when the bib number doesn't exist
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Bug ID: 36891 Summary: Restore returning 404 from svc/bib when the bib number doesn't exist Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: phil@chetcolibrary.org Reporter: phil@chetcolibrary.org QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Prior to bug 29697, svc/bib used GetMarcBiblio which returned undef if the requested bib number didn't exist, and returned a 404 if the record was undefined. That was switched to using Koha::Biblios->find, which returns undef if the bib number doesn't exist, and then calling undef->metadata->record, which doesn't go well. The if (defined $record) just needs to move up a line and be if (defined $biblio) on the return from the call that actually does return undef. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #1 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 166858 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166858&action=edit Bug 36891: Naive attempt to fix svc/bib to return 404 when bib number not found But of course it can't be simple. After just adding if ( defined $biblio ) and reindenting and tidying what I indented, I'm told that I made two more untidy lines. And there's a bad smell around the "if ( defined $record )" since I don't see how it could be false, because $biblio->metadata->record doesn't return undef. But maybe I'm missing something. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|phil@chetcolibrary.org |koha-bugs@lists.koha-commun | |ity.org --- Comment #2 from Phil Ringnalda <phil@chetcolibrary.org> --- The nice part is that it works, http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 returns a bib, http://127.0.0.1:8081/cgi-bin/koha/svc/bib/999999999 returns a 404. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |phil@chetcolibrary.org |ity.org | CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #3 from Phil Ringnalda <phil@chetcolibrary.org> --- D'oh, I told myself in comment 0 to move that if (defined $record), not add a second if (defined $biblio). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #4 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 166914 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166914&action=edit Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist Changing from GetMarcBiblio to Biblios->find plus metadata->record lost the way that svc/bib used to return 404 when the bib number wasn't found. This patch restores that by checking for undef after the Biblios->find step. Test plan: 1. Load e.g. http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 which returns an XML bib record 2. Load http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 500 error 2. Appply patch, restart_all 4. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 and get the bib again 5. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 404 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #166858|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #166914|0 |1 is obsolete| | --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 166923 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166923&action=edit Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist Changing from GetMarcBiblio to Biblios->find plus metadata->record lost the way that svc/bib used to return 404 when the bib number wasn't found. This patch restores that by checking for undef after the Biblios->find step. Test plan: 1. Load e.g. http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 which returns an XML bib record 2. Load http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 500 error 2. Appply patch, restart_all 4. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 and get the bib again 5. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 404 Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Lauren Denny <lauren_denny@sil.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lauren_denny@sil.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Having the impression that I got the 404 also without your patch. But I cant understand that either? Is Plack fooling me? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #7 from Phil Ringnalda <phil@chetcolibrary.org> --- (In reply to Marcel de Rooy from comment #6)
Having the impression that I got the 404 also without your patch. But I cant understand that either? Is Plack fooling me?
I hope it's Plack fooling you, since the code path to have that happen would be to have eval { $record = undef->metadata->record } not set $@. If you change https://git.koha-community.org/Koha-community/Koha/src/commit/b16e2059a94cf8... to return something other than 404, like maybe 406 Not Acceptable, do you get that, or still 404? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #166923|0 |1 is obsolete| | --- Comment #8 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 168101 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168101&action=edit Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist Changing from GetMarcBiblio to Biblios->find plus metadata->record lost the way that svc/bib used to return 404 when the bib number wasn't found. This patch restores that by checking for undef after the Biblios->find step. Test plan: 1. Load e.g. http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 which returns an XML bib record 2. Load http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 500 error 2. Appply patch, restart_all 4. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 and get the bib again 5. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 404 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.11! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37212 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37212 [Bug 37212] Advanced editor should warn the user when it loads a blank record after being passed an invalid bib number -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.11.00 |24.11.00,24.05.02 released in| | CC| |lucas@bywatersolutions.com Status|Pushed to main |Pushed to stable --- Comment #10 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 24.05.x for upcoming 24.05.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.11.00,24.05.02 |24.11.00,24.05.02,23.11.07 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to stable |Pushed to oldstable --- Comment #11 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|martin.renvoize@ptfs-europe | |.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes requests made release notes| |for records that don't | |exist using the | |/svc/bib/<biblionumber> | |HTTP API. A 404 error (Not | |Found) is now returned if a | |record doesn't exist, | |instead of a 505 error | |(HTTP Version Not | |Supported). CC| |david@davidnind.com --- Comment #12 from David Nind <david@davidnind.com> --- I'm not sure if I got the name of this (old?) API right in the release note (I used the information from https://wiki.koha-community.org/wiki/Koha_/svc/_HTTP_API). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 wainuiwitikapark@catalyst.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.11.00,24.05.02,23.11.07 |24.11.00,24.05.02,23.11.07, released in| |23.05.15 CC| |wainuiwitikapark@catalyst.n | |et.nz Status|Pushed to oldstable |Pushed to oldoldstable --- Comment #13 from wainuiwitikapark@catalyst.net.nz --- Applied to 23.05.x for 23.05.15 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldoldstable |Needs documenting --- Comment #14 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11 unless requested -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com Status|Needs documenting |RESOLVED Resolution|--- |FIXED --- Comment #15 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- This looks like a bug fix, nothing to change in the manual. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36891 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|caroline.cyr-la-rose@inlibr | |o.com | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org