Bugzilla – Attachment 153104 Details for
Bug 33974
Add ability to search biblios endpoint using any biblioitem attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33974: (follow-up) _order_by is not always an arrayref
Bug-33974-follow-up-orderby-is-not-always-an-array.patch (text/plain), 1.88 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-07-06 18:53:28 UTC
(
hide
)
Description:
Bug 33974: (follow-up) _order_by is not always an arrayref
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-07-06 18:53:28 UTC
Size:
1.88 KB
patch
obsolete
>From 82016f6fb55b4cc49e71893a4a06c7182c66353c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 6 Jul 2023 15:50:40 -0300 >Subject: [PATCH] Bug 33974: (follow-up) _order_by is not always an arrayref > >The loop through the `_order_by` query parameter occurences introduced >by this patchset was naive regarding the possible scenarios. > >When there's only one parameter passed, it shouldn't be expecting an >arrayref, but a scalar. This patch deals with that in the simplest way. > >To test: >1. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t >=> FAIL: Tests are failing >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests pass! >4. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/Plugin/Objects.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index f09bf70bd6a..512010dd813 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -161,10 +161,15 @@ controller, and thus shouldn't be called twice in it. > $c->extract_reserved_params($args); > > if ( exists $reserved_params->{_order_by} ) { >+ >+ # convert to arrayref if it is a single param, to keep code simple >+ $reserved_params->{_order_by} = [ $reserved_params->{_order_by} ] >+ unless ref( $reserved_params->{_order_by} ) eq 'ARRAY'; >+ > # _order_by passed, fix if required >- for my $p ( @{$reserved_params->{_order_by}} ) { >+ for my $p ( @{ $reserved_params->{_order_by} } ) { > foreach my $qf ( @{$query_fixers} ) { >- $p = $qf->($p, 1); # 1 => no quotes on matching >+ $p = $qf->( $p, 1 ); # 1 => no quotes on matching > } > } > } >-- >2.41.0
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 33974
:
152433
|
152434
|
152435
|
152487
|
152488
|
152489
|
152765
|
152766
|
152767
|
152983
|
152984
|
152985
|
152986
|
152988
| 153104