Bugzilla – Attachment 128170 Details for
Bug 29484
ListSets doesn't return noSetHierarchy when appropriate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29484: Make ListSets return noSetHierarchy when no sets defined
Bug-29484-Make-ListSets-return-noSetHierarchy-when.patch (text/plain), 1.68 KB, created by
Jonathan Druart
on 2021-12-02 14:24:12 UTC
(
hide
)
Description:
Bug 29484: Make ListSets return noSetHierarchy when no sets defined
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-12-02 14:24:12 UTC
Size:
1.68 KB
patch
obsolete
>From 377bfab2dabdfe98b6f005b559c25550d30f12a8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 15 Nov 2021 09:52:15 -0300 >Subject: [PATCH] Bug 29484: Make ListSets return noSetHierarchy when no sets > defined > >This simple patch makes our OAI-PMH server return the appropriate error >code when no sets are defined. > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ t/db_dependent/OAI/Server.t >=> FAIL: Tests fail. Boo! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! YAY! >5. Sign off :-D > >Bonus: you can check with the tool mentioned on the bug report, that >the error is gone. No sets need to be defined. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Nind <david@davidnind.com> > >JD amended patch >- ) unless scalar @{$sets} > 0; >+ ) unless @$sets; > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/OAI/Server/ListSets.pm | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/Koha/OAI/Server/ListSets.pm b/Koha/OAI/Server/ListSets.pm >index 6fc245daeb3..a74dda1bad4 100644 >--- a/Koha/OAI/Server/ListSets.pm >+++ b/Koha/OAI/Server/ListSets.pm >@@ -34,6 +34,17 @@ sub new { > my $token = Koha::OAI::Server::ResumptionToken->new(%args); > my $sets = GetOAISets; > my $pos = 0; >+ >+ return HTTP::OAI::Response->new( >+ requestURL => $repository->self_url(), >+ errors => [ >+ HTTP::OAI::Error->new( >+ code => 'noSetHierarchy', >+ message => 'There are no OAI sets defined', >+ ) >+ ], >+ ) unless @$sets; >+ > foreach my $set (@$sets) { > if ($pos < $token->{cursor}) { > $pos++; >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29484
:
127637
|
127638
|
127995
|
127996
|
128169
| 128170