Bugzilla – Attachment 105932 Details for
Bug 25774
REST API searches don't handle correctly utf8 characters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25774: replace decode_json with from_json
Bug-25774-replace-decodejson-with-fromjson.patch (text/plain), 1.72 KB, created by
David Cook
on 2020-06-17 04:18:45 UTC
(
hide
)
Description:
Bug 25774: replace decode_json with from_json
Filename:
MIME Type:
Creator:
David Cook
Created:
2020-06-17 04:18:45 UTC
Size:
1.72 KB
patch
obsolete
>From 1797397f158e8c143c816ba14aac2e712609ff23 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 17 Jun 2020 04:17:06 +0000 >Subject: [PATCH] Bug 25774: replace decode_json with from_json > >decode_json expects octets/bytes but from_json expects a string. > >We don't need to encode the query parameters as bytes to give to >decode_json. Instead, we can just pass the string to from_json, >and it will work as expected. >--- > Koha/REST/Plugin/Objects.pm | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index 47c2659cce..e313ea87f9 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -19,8 +19,7 @@ use Modern::Perl; > > use Mojo::Base 'Mojolicious::Plugin'; > >-use JSON qw(decode_json); >-use Encode qw(encode_utf8); >+use JSON qw(from_json); > > =head1 NAME > >@@ -105,8 +104,8 @@ sub register { > my @query_params_array; > my $query_params; > push @query_params_array, $reserved_params->{query} if defined $reserved_params->{query}; >- push @query_params_array, decode_json(encode_utf8 $reserved_params->{q}) if defined $reserved_params->{q}; >- push @query_params_array, decode_json(encode_utf8 $reserved_params->{'x-koha-query'}) if defined $reserved_params->{'x-koha-query'}; >+ push @query_params_array, from_json($reserved_params->{q}) if defined $reserved_params->{q}; >+ push @query_params_array, from_json($reserved_params->{'x-koha-query'}) if defined $reserved_params->{'x-koha-query'}; > > if(scalar(@query_params_array) > 1) { > $query_params = {'-and' => \@query_params_array}; >-- >2.11.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 25774
:
105920
|
105930
|
105932
|
105935
|
106109
|
106110