Bugzilla – Attachment 128692 Details for
Bug 29523
Add a way to prevent embedding objects that should not be allowed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29523: (QA follow-up) Catch remaining SUPER::to_api cases
Bug-29523-QA-follow-up-Catch-remaining-SUPERtoapi-.patch (text/plain), 3.59 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-12-17 21:39:35 UTC
(
hide
)
Description:
Bug 29523: (QA follow-up) Catch remaining SUPER::to_api cases
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-12-17 21:39:35 UTC
Size:
3.59 KB
patch
obsolete
>From c436d0253893c245d21b907575cfa4d6fda4a519 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 26 Nov 2021 13:40:15 +0000 >Subject: [PATCH] Bug 29523: (QA follow-up) Catch remaining SUPER::to_api cases > >Koha::Object->to_api can now return undefined.. we should be catching >that cases in all post manipulation cases. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Acquisition/Basket.pm | 7 ++++--- > Koha/Acquisition/Fund.pm | 2 ++ > Koha/Acquisition/Invoice.pm | 7 ++++--- > Koha/Biblio.pm | 8 +++++--- > Koha/SMTP/Server.pm | 7 ++++--- > 5 files changed, 19 insertions(+), 12 deletions(-) > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index 556fa326b0..f22673ef9f 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -250,13 +250,14 @@ suitable for API output. > sub to_api { > my ( $self, $params ) = @_; > >- my $json = $self->SUPER::to_api( $params ); >+ my $json_basket = $self->SUPER::to_api( $params ); >+ return unless $json_basket; > >- $json->{closed} = ( $self->closedate ) >+ $json_basket->{closed} = ( $self->closedate ) > ? Mojo::JSON->true > : Mojo::JSON->false; > >- return $json; >+ return $json_basket; > } > > =head3 to_api_mapping >diff --git a/Koha/Acquisition/Fund.pm b/Koha/Acquisition/Fund.pm >index 80ef0b2f4a..3acc8f99ba 100644 >--- a/Koha/Acquisition/Fund.pm >+++ b/Koha/Acquisition/Fund.pm >@@ -62,6 +62,8 @@ sub to_api { > my $budget_period_id = $self->budget_period_id; > > my $json_fund = $self->SUPER::to_api($args); >+ return unless $json_fund; >+ > $json_fund->{fund_id} = $budget_id; > $json_fund->{budget_id} = $budget_period_id; > >diff --git a/Koha/Acquisition/Invoice.pm b/Koha/Acquisition/Invoice.pm >index df46b65a30..5b9d9cc3ef 100644 >--- a/Koha/Acquisition/Invoice.pm >+++ b/Koha/Acquisition/Invoice.pm >@@ -41,13 +41,14 @@ suitable for API output. > sub to_api { > my ( $self, $params ) = @_; > >- my $json = $self->SUPER::to_api( $params ); >+ my $json_invoice = $self->SUPER::to_api( $params ); >+ return unless $json_invoice; > >- $json->{closed} = ( $self->closedate ) >+ $json_invoice->{closed} = ( $self->closedate ) > ? Mojo::JSON->true > : Mojo::JSON->false; > >- return $json; >+ return $json_invoice; > } > > =head3 to_api_mapping >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index a259db4bb7..30cf2ffe37 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -1075,10 +1075,12 @@ on the API. > sub to_api { > my ($self, $args) = @_; > >- my $response = $self->SUPER::to_api( $args ); >- my $biblioitem = $self->biblioitem->to_api; >+ my $json_biblio = $self->SUPER::to_api( $args ); >+ return unless $json_biblio; >+ my $json_biblioitem = $self->biblioitem->to_api; >+ return unless $json_biblioitem; > >- return { %$response, %$biblioitem }; >+ return { %$json_biblio, %$json_biblioitem }; > } > > =head3 to_api_mapping >diff --git a/Koha/SMTP/Server.pm b/Koha/SMTP/Server.pm >index 7a2a40cb18..707a80b90a 100644 >--- a/Koha/SMTP/Server.pm >+++ b/Koha/SMTP/Server.pm >@@ -112,10 +112,11 @@ suitable for API output. > sub to_api { > my ( $self, $params ) = @_; > >- my $json = $self->SUPER::to_api( $params ); >- delete $json->{password}; >+ my $json_smtp = $self->SUPER::to_api( $params ); >+ return unless $json_smtp; >+ delete $json_smtp->{password}; > >- return $json; >+ return $json_smtp; > } > > =head3 to_api_mapping >-- >2.34.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 29523
:
127886
|
127887
|
127888
|
127889
|
127991
|
127992
|
127993
|
127994
|
128042
|
128043
|
128044
|
128045
|
128046
|
128047
|
128048
|
128688
|
128689
|
128690
|
128691
|
128692
|
128693
|
128694
|
131326
|
131331
|
131332
|
136684
|
136685
|
136686
|
136687
|
136688
|
136689
|
136690
|
136691
|
136692
|
136706
|
136714
|
148736
|
148737
|
148738
|
148739
|
148740
|
148741
|
148742
|
148743
|
148744
|
148745
|
150989
|
150990
|
150991
|
150992
|
150993
|
150994
|
150995
|
150996
|
150997
|
150998
|
156939
|
156940
|
156941
|
156942
|
156943
|
156944
|
156945
|
156946
|
156947
|
156948
|
156949
|
156965
|
157049
|
157071
|
157072
|
157073
|
157074
|
157075
|
157076
|
157077
|
157078
|
157079
|
157080
|
157081
|
157406
|
157407
|
157408
|
157409
|
157410
|
157411
|
157412
|
157413
|
157414
|
157415
|
157416
|
157673
|
157679
|
157683
|
157799
|
157881
|
157882
|
157883
|
157884
|
157885
|
157886
|
157887
|
157888
|
157889
|
157890
|
157891
|
157892
|
157893
|
158013